npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ban-chess-engine

v0.2.0

Published

AI engine for Ban Chess variant using minimax algorithm

Readme

Ban Chess Engine

An AI engine for the Ban Chess variant, built on top of the ban-chess.ts library.

Overview

This engine uses traditional chess AI techniques (minimax with alpha-beta pruning) adapted for Ban Chess. The key insight is that the ban-chess.ts library's ply-based system allows us to treat bans and moves uniformly - each ply is simply an action in the game tree.

Features

  • Standard minimax algorithm with alpha-beta pruning
  • Iterative deepening for better time management
  • Position evaluation tailored for Ban Chess:
    • Material balance
    • Mobility (number of legal actions)
    • King safety with ban vulnerability assessment
    • Center control
  • Simple CLI interface to play against the engine

Installation

cd ban-chess-engine
npm install
npm run build

Usage

Playing against the engine

npm run play

Using the engine programmatically

import { BanChess } from 'ban-chess.ts';
import { BanChessEngine } from 'ban-chess-engine';

const game = new BanChess();
const engine = new BanChessEngine({
  maxDepth: 6,        // Search depth in plies
  timeLimit: 5000     // Time limit in milliseconds
});

// Get best action for current position
const result = engine.findBestAction(game);
if (result.action) {
  game.play(result.action);
  console.log(`Engine played with score: ${result.score}`);
}

Architecture

The engine leverages the ply-based system from ban-chess.ts:

  • Ply 1: Black bans
  • Ply 2: White moves
  • Ply 3: White bans
  • Ply 4: Black moves
  • etc.

This means we can use standard minimax without special handling for the ban/move alternation. Each ply is treated as a single node in the search tree.

Evaluation Function

The position evaluation considers:

  1. Material: Standard piece values
  2. Mobility: Number of available actions (bans or moves)
  3. King Ban Safety: Kings near edges are more vulnerable to ban-induced checkmates
  4. Center Control: Controlling central squares

Performance

The engine searches approximately 6-8 plies deep in typical middlegame positions within a 3-second time limit. The actual depth depends on:

  • Position complexity
  • Number of legal actions
  • Alpha-beta pruning effectiveness

Future Improvements

  • Opening book specifically for Ban Chess patterns
  • Endgame tablebases for ban positions
  • Transposition tables to avoid re-evaluating positions
  • Improved move ordering for better pruning
  • Machine learning for evaluation tuning