New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

ban-chess-engine

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ban-chess-engine

AI engine for Ban Chess variant using minimax algorithm

latest
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

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:

  • Material: Standard piece values
  • Mobility: Number of available actions (bans or moves)
  • King Ban Safety: Kings near edges are more vulnerable to ban-induced checkmates
  • 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

FAQs

Package last updated on 05 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts