Fairy-Stockfish is a chess variant engine derived from Stockfish, designed to support numerous chess variants and protocols. Written primarily in C++17, it includes Python and JavaScript bindings for library use.
Repository Statistics:
- Languages: C++17 (primary), Python, JavaScript, Shell scripts
- Architecture: Multi-protocol chess engine (UCI, UCCI, USI, XBoard/CECP)
- Target Platforms: Windows, Linux, macOS, Android, WebAssembly
- Supported Variants: 90+ chess variants including regional, historical, and modern variants
- Compiler: GCC, Clang, or MSVC with C++17 support
- Build Tool: GNU Make (required for C++ engine)
- Python: 3.7+ (for Python bindings)
- Node.js: (for JavaScript bindings)
- Additional Tools: expect utility (for testing)
Note: Run engine and test commands from the src/ directory unless specified otherwise.
# Standard release build (recommended for most users)
make -j2 ARCH=x86-64 build
# Debug build (for development)
make -j2 ARCH=x86-64 debug=yes build
# All variants including ones with large boards (up to 12x10) and large branching factor (all)
make -j2 ARCH=x86-64 largeboards=yes all=yes build# Build Python bindings (from repository root)
python3 setup.py install
# Alternative: Install from PyPI
pip install pyffishAlso see the tests/js/README.md.
cd src/
# Build JavaScript bindings (requires emscripten)
make -f Makefile_js build
# Alternative: Install from npm
npm install ffishAll test commands below assume the current directory is src/.
# Basic functionality test
./stockfish bench
# Variant-specific benchmarks
./stockfish bench xiangqi
./stockfish bench shogi
./stockfish bench capablanca
# Validate variants configuration
./stockfish check variants.ini# Protocol compliance tests
../tests/protocol.sh
# Move generation validation
../tests/perft.sh all
../tests/perft.sh chess # Chess only
../tests/perft.sh largeboard # Large board variants only
# Regression testing
../tests/regression.sh
# Reproducible search test
../tests/reprosearch.sh
# Build signature verification
../tests/signature.shsrc/ # Core C++ engine source
tests/ # Test scripts and data
.github/workflows/ # CI/CD configurations
src/variants.ini: Defines examples for configuration of chess variantssetup.py: Python package build configurationtests/js/package.json: JavaScript bindings configuration
variant.h: Variant rule propertiesvariant.cpp: Variant-specific game rulesvariant.ini: Variant rule configuration examples and documentation of variant propertiesposition.h: Position representationposition.cpp: Board logicmovegen.cpp: Move generation logicparser.cpp: Variant rule configuration parsingpiece.cpp: Piece type definitions and behaviorpyffish.cpp: Python bindingsffishjs.cpp: JavaScript bindings
fairy.yml: Core engine testing (perft, protocols, variants)stockfish.yml: Standard Stockfish compatibility testsrelease.yml: Binary releases for multiple platformswheels.yml: Python package buildsffishjs.yml: JavaScript binding builds
- Always test basic functionality:
./stockfish benchafter changes - Validate variant compatibility:
./stockfish check variants.ini - Run relevant tests:
../tests/perft.sh allfor move generation changes
- Edit
src/variants.ini: Add variant configuration - Test parsing:
./stockfish check variants.ini
- Chess Variants on Wikipedia
- Chess Variants Wiki
- Variant Chess on BoardGameGeek
- PyChess Variants
- Ludii
- Lichess.org Variants
- Greenchess
- Chess Variants on Chess.com
- Make sure to only stage and commit changes that were changed as part of the task, do not simply add all changes.
- Keep changes minimal and focused on the task at hand.
- After applying changes make sure that all places related to the task have been identified.
- Stay consistent with the existing code style and conventions.