/fairy-stockfish

chess variant engine supporting Xiangqi, Shogi, Janggi, Makruk, S-Chess, Crazyhouse, Bughouse, and many more

Primary LanguageC++GNU General Public License v3.0GPL-3.0

Fairy-Stockfish

Build Status Build Status Build Status PyPI version NPM version

Overview

Fairy-Stockfish is a chess variant engine derived from Stockfish designed for the support of fairy chess variants and easy extensibility with more games. It can play various regional, historical, and modern chess variants as well as games with user-defined rules. For compatibility with graphical user interfaces it supports the UCI, UCCI, USI, UCI-cyclone, and CECP/XBoard protocols.

The goal of the project is to create an engine supporting a large variety of chess-like games, equipped with the powerful search of Stockfish. Despite its generality the playing strength is on a very high level in almost all supported variants. Due to its multi-protocol support Fairy-Stockfish works with almost any chess variant GUI.

Developers Guide

Get your feet wet quickly via the guide here: Developers Guide.

Installation

You can download the Windows executable or Linux binary from the latest release or compile the program from source. The program comes without a graphical user interface, so you perhaps want to use it together with a compatible GUI, or play against it online at pychess, lishogi, or lichess. Read more about how to use Fairy-Stockfish in the wiki.

If you want to preview the functionality of Fairy-Stockfish before downloading, you can try it out on the Fairy-Stockfish playground in the browser.

Optional NNUE evaluation parameter files to improve playing strength for many variants are in the list of NNUE networks. For the regional variants Xiangqi, Janggi, and Makruk dedicated releases with built-in NNUE networks are available. See the wiki for more details on NNUE.

Contributing

If you like this project, please support its development via patreon or paypal, by contributing CPU time to the framework for testing of code improvements, or by contributing to the code or documentation. An introduction to the code base can be found in the wiki.

Supported games

The games currently supported besides chess are listed here: Fairy Stockfish Supported Games. Fairy-Stockfish can also play user-defined variants loaded via a variant configuration file, see the file src/variants.ini and the wiki.

Help

See the Fairy-Stockfish Wiki for more info, or if the required information is not available, open an issue or join our discord server.

Bindings

Besides the C++ engine, this project also includes bindings for other programming languages in order to be able to use it as a library for chess variants. They support move, SAN, and FEN generation, as well as checking of game end conditions for all variants supported by Fairy-Stockfish. Since the bindings are using the C++ code, they are very performant compared to libraries directly written in the respective target language.

Python

The python binding pyffish contributed by @gbtami is implemented in pyffish.cpp. It is e.g. used in the backend for the pychess server.

Javascript

The javascript binding ffish.js contributed by @QueensGambit is implemented in ffishjs.cpp. The compilation/binding to javascript is done using emscripten, see the readme.

WebAssembly Port

For in-browser use a port of Fairy-Stockfish to WebAssembly is available at npm. It is e.g. used for local analysis on pychess.org. Also see the Fairy-Stockfish WASM demo available at https://fairy-stockfish-nnue-wasm.vercel.app/.

Stockfish Overview

An overview on Stockfish itself, the engine that Fairy Stockfish is built on, is linked here: Stockfish Overview.