Skip to content

About

IronPhoenix is a high-performance C++20 four-player chess engine for Chess.com-style Teams, featuring PVS/Negamax search, transposition tables, SEE, LMR, history heuristics, quiescence search, FEN4 support, and UCI-style commands.

Topics

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

79 Commits

Folders and files

Repository files navigation

๐Ÿ”ฅ IronPhoenix

IronPhoenix is a high-performance 4-player chess Teams engine written in modern C++20.

It is built around the chess.com-style 4PC cross board, team-aware search, fast move generation, handcrafted evaluation, and PhoenixNet, a purpose-built NNUE evaluator for four-player Teams chess.

โค๏ธ Built with love by Nick.


โ™Ÿ๏ธ What IronPhoenix Plays

IronPhoenix is designed for 4-player Teams chess:

  • Red + Yellow vs Blue + Green
  • Turn order: Red โ†’ Blue โ†’ Yellow โ†’ Green
  • 14ร—14 cross-shaped board
  • 160 playable squares
  • Team-aware king safety and terminal king-capture handling
  • Four-player castling, promotion, en-passant, and move-generation rules
  • Four-player FEN parsing and position setup

The engine evaluates positions from the side-to-move team perspective: positive scores favor the team whose player is currently moving.


โšก Engine Features

๐Ÿ”Ž Search

IronPhoenix includes a modern alpha-beta search stack designed specifically for four-player Teams chess:

  • Negamax / PVS-style search
  • Quiescence search
  • Aspiration Windows
  • Transposition tables
  • History-based move ordering
  • Static Exchange Evaluation (SEE)
  • Late Move Reductions (LMR)
  • Late Move Pruning (LMP)
  • Search pruning and reductions
  • Iterative deepening
  • Principal variation reporting
  • Time / depth search limits
  • MultiPV root search

MultiPV=1 keeps the normal single-PV search path. Higher values use the dedicated MultiPV root search.

setoption name MultiPV value 4
go depth 8

๐Ÿงฎ Evaluation

IronPhoenix supports two evaluation paths.

๐Ÿ› ๏ธ Handcrafted Evaluation

The HCE currently provides the engine's deterministic fallback and PhoenixNet teacher foundation, including:

  • Material
  • Mobility
  • Team-relative scoring

๐Ÿง  PhoenixNet NNUE

PhoenixNet is IronPhoenix's native neural evaluator.

Current PhoenixNet v1 architecture:

  • 65,280 sparse input features
  • 17 king buckets
  • 4 relative piece colors
  • 6 piece types
  • Own-king feature stream
  • Partner-king feature stream
  • 128-wide shared feature transformer
  • 256 โ†’ 32 โ†’ 32 โ†’ 1 dense network
  • Centipawn-like side-to-move-team output

If ironphoenix.nnue is available beside the executable, IronPhoenix loads it automatically. Otherwise it falls back to HCE.

For the full PhoenixNet architecture, dataset format, training flow, export format, append/resume support, and generator options, see ๐Ÿง  PhoenixNet NNUE documentation.


๐Ÿ—๏ธ Building IronPhoenix

๐Ÿ“‹ Requirements

  • CMake 3.24+
  • A C++20 compiler
  • Visual Studio / MSVC, Clang, or GCC
  • Threads support

๐ŸชŸ Windows / Visual Studio

From the project root:

cmake -S . -B build -DIRONPHOENIX_BUILD_DATASET_GENERATOR=ON
cmake --build build --config Release

To build only the engine:

cmake --build build --config Release --target ironphoenix

To build only the PhoenixNet dataset generator:

cmake --build build --config Release --target ironphoenix_dataset

If you are using the Visual Studio CMake x64-release layout used during development:

cmake --build out\build\x64-release --target ironphoenix
cmake --build out\build\x64-release --target ironphoenix_dataset

โ–ถ๏ธ Running the Engine

Launch the engine executable and enter UCI-style commands:

uci
isready
position startpos
go depth 8

Enable MultiPV:

setoption name MultiPV value 4
position startpos
go depth 8

Useful engine options include:

setoption name Hash value 256
setoption name MultiPV value 4
setoption name Clear Hash

๐Ÿงช PhoenixNet Dataset Generation

The project builds a native dataset generator:

ironphoenix_dataset

It generates self-play positions using the engine search as a teacher and stores the exact sparse features consumed by PhoenixNet.

๐Ÿš€ Example dataset run

ironphoenix_dataset.exe --positions 500000 --depth 8 --workers 8 --hash 16 --random-plies 8 --skip-plies 12 --sample-every 3 --exploration 0.15 --exploration-multipv 4 --exploration-temperature 120 --exploration-max-loss 250 --dedup --output "..\..\..\nnue\phoenix-v1.ipd"

The generator supports:

  • Parallel self-play workers
  • Controlled MultiPV exploration
  • Single-PV search for non-exploration positions
  • NNUE-feature deduplication
  • Randomized opening plies
  • Native compact .ipd datasets
  • Safe append mode
  • Resume-to-total mode
  • Graceful Ctrl+C stopping
  • Recovery of complete records from older interrupted runs
  • Progress reporting every 10 saved positions

๐Ÿ›‘ Stop and resume safely

Press Ctrl+C once. The generator stops active searches, joins its workers, flushes records, and commits the current dataset count.

Resume toward a total target:

ironphoenix_dataset.exe --resume --positions 500000 --depth 8 --workers 8 --hash 16 --dedup --output "..\..\..\nnue\phoenix-v1.ipd"

If the file already contains 50,000 positions, this produces only the remaining 450,000.


๐Ÿ‹๏ธ Training PhoenixNet

Create a Python environment:

py -m venv nnue\.venv
.\nnue\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install torch numpy

Train:

python nnue\train.py nnue\phoenix-v1.ipd `
    --epochs 20 `
    --batch-size 1024 `
    --lr 0.001 `
    -o nnue\phoenixnet-v1.pt

Export to the native IronPhoenix NNUE format:

python nnue\export.py nnue\phoenixnet-v1.pt `
    -o ironphoenix.nnue `
    --output-scale 400

Place ironphoenix.nnue beside ironphoenix.exe and start the engine. A successful load prints:

PhoenixNet loaded: ironphoenix.nnue

๐Ÿ“ Project Layout

IronPhoenix/
โ”œโ”€โ”€ include/ironphoenix/     # Public engine headers
โ”œโ”€โ”€ src/                     # Engine implementation
โ”œโ”€โ”€ tools/                   # Dataset generation tools
โ”œโ”€โ”€ tests/                   # Correctness tests and benchmarks
โ”œโ”€โ”€ nnue/                    # PhoenixNet model, trainer, exporter, docs
โ”œโ”€โ”€ CMakeLists.txt           # Build configuration
โ””โ”€โ”€ README.md                # Project overview

๐Ÿงญ Development Direction

IronPhoenix is under active development. Current and planned work includes:

  • Stronger handcrafted evaluation terms
  • Larger and more diverse PhoenixNet datasets
  • Incremental NNUE accumulators
  • Quantized NNUE weights
  • SIMD / AVX2 inference
  • Search tuning and SPRT testing
  • Opening-book / explorer integration
  • Continued search-performance work

PhoenixNet v1 intentionally keeps a straightforward full-refresh inference path as a correctness baseline before aggressive optimization.


โค๏ธ Author

IronPhoenix is developed by Nick / KnightStackSys as a dedicated high-performance engine for 4-player Teams chess.

๐Ÿ”ฅ Build. Search. Learn. Rise.

About

IronPhoenix is a high-performance C++20 four-player chess engine for Chess.com-style Teams, featuring PVS/Negamax search, transposition tables, SEE, LMR, history heuristics, quiescence search, FEN4 support, and UCI-style commands.

Topics

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages