Skip to content

FirePlank/infinite-chess-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

528 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apeiron

A Rust chess engine compiled to WebAssembly, designed for Infinite Chess.

License: GPL-3.0

Elo Gain Over Time

Apeiron Elo gain history

Documentation

Document Description
Setup Guide Installation and build instructions
Contributing Guide Workflow for development and testing
Engine Architecture Deep dive into engine design and logic
SPRT Testing Strength validation tools
Utility Binaries Solvers, debuggers, and tuning scripts
Roadmap Current status and planned features

Features

  • Infinite Board: Coordinate-based system supporting arbitrary board sizes.
  • Search: Iterative deepening PVS with aspiration windows, null move pruning, LMR, history-based move ordering, and more.
  • Evaluation: Modular HCE (Material, Cloud Centrality, Pawn Advancement, King Safety, etc.) with experimental NNUE support.
  • Performance: Written in Rust with support for Lazy SMP multithreading.
  • Variants & Fairy Pieces: Support for all fairy pieces and unique infinite chess variants.

Quick Start

# 1. Install Rust and wasm-pack (see docs/SETUP.md for details)
cargo install wasm-pack

# 2. Build for browser (Multi-threaded / Lazy SMP is the default)
wasm-pack build --target web --release

# 3. Build a single-threaded engine instead
wasm-pack build --target web --release --no-default-features

# 4. Output is in pkg/

For detailed setup instructions, see docs/SETUP.md.


Usage

JavaScript API

import init, { Engine } from './pkg/apeiron.js';

await init();

// Initialize engine from ICN string
const icnString = "w 0/100 1 (8|1) P1,2+|P2,2+|P3,2+|P4,2+|P5,2+|P6,2+|P7,2+|P8,2+|...|K5,1+|k5,8+";
const engineConfig = {
    strength_level: 3, // 1=Easy, 2=Medium, 3=Hard (default)
    wtime: 60000,      // White clock in ms
    btime: 60000,      // Black clock in ms
    winc: 1000,        // White increment in ms
    binc: 1000         // Black increment in ms
};

const engine = Engine.from_icn(icnString, engineConfig);

// Get best move
const result = engine.get_best_move();
// Example result: { from: "1,2", to: "1,4", promotion: null, eval: 34, depth: 12 }

// Get legal moves
const moves = engine.get_legal_moves_js();

Multithreaded Search

To use parallel search, you must initialize the WASM module's thread pool:

import init, { Engine, initThreadPool } from './pkg/apeiron.js';

await init();
await initThreadPool(navigator.hardwareConcurrency);

const engine = Engine.from_icn(icnString, engineConfig);
const result = engine.get_best_move(); // Now uses all available cores

Note

Parallel WASM requires specific HTTP headers (Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp) to be served by your web server.

Testing

# Run unit tests
cargo test --lib

# Run perft tests
cargo test --test perft

For strength testing, see sprt/README.md.


License

This project is licensed under the GNU General Public License v3.0 - see LICENSE for details.

Links

About

A chess engine made for the infinitechess.org website that can play on an unbounded board.

Topics

Resources

License

Contributing

Stars

25 stars

Watchers

2 watching

Forks

Packages

 
 
 

Contributors