Raphael is a superhuman UCI Chess Engine built using C++. It also comes with a GUI built using SFML.
You can scroll to the bottom to see a list of features currently implemented, and also download the prebuilt binaries to try Raphael out for yourself.
Raphael is largely inspired by Sebastian Lague's Coding Adventure series on implementing a Chess Engine, and is a revisit/successor to a previous engine I coded in Python.
The following are the historic elo for Raphael.
Note that elos with an asterics next to them are estimates and not official, and were estimated by running tournaments against Stash (and sometimes a few other engines) using fastchess.
| Version | CCRL Blitz | CCRL 40/15 |
|---|---|---|
| 3.1.0 | 3520* | 3428* |
| 3.0.0 | 3321* | 3197 |
| 2.3.0 | 3146* | 3061 |
| 2.2.0 | 3035* | 2953 |
| 2.1.0 | 2739* | 2689 |
| 2.0.0 | 2646* | |
| 1.8.0 | 2223* | |
| 1.7.6 | 1970 | |
| 1.7.0 | 1853 | |
| 1.6.0 | 1797* | |
| 1.5.0 | 1764* |
Builds of the UCI engine for Windows and Linux/WSL are available on the Releases page. In general, you should use the avx2-bmi2 build (on pre-Zen 3 AMD CPUs, the avx2 build can be significantly faster than the avx2-bmi2 build).
Please refer to the following section to compile the GUI and/or the engine yourself on Windows and Linux. The features section outline the supported commands and features of the GUI and UCI engine.
Follow these steps to build Raphael yourself. Note that it is highly recommended you build on WSL if you are on Windows.
-
Clone the repository with
git clone https://github.com/Orbital-Web/Raphael.git
-
Ensure you have Make and g++ installed. If you are on Linux/WSL, you can do so by running:
sudo apt-get install build-essential g++ # Linux/WSLOtherwise, if you are on Windows, follow this guide to install MSYS2 and run the following command inside the MSYS2 UCRT64 terminal:
pacman -S --needed mingw-w64-ucrt-x86_64-toolchain make # Windows -
Compile as follows:
make uci # build UCI engine make packages # download SFML, required to build main make main # build GUI
The GUI is a quick and easy way to start engine battles or play against Raphael interactively. To start a quick GUI match against yourself and Raphael as follows:
main.exe human "Human" Raphael "Raphael" -s "game.pgn" # Windows
./main human "Human" Raphael "Raphael" -s "game.pgn" # Linux/WSLYou can see other command-line arguments by running main.exe -h.
The human player can move a piece by either dragging and dropping a piece to the destination square, or by clicking a piece and clicking the destination square. Castling can be done by clicking the destination square of the king after castling. Only promotion by queening is currently supported. You can also annotate the board with arrows by holding and dragging the right mouse button.
You can also play with different time controls, increments, and player combinations. Again, please refer to main.exe -h and the setup instructions above for a more in-depth guide.
Raphael is a UCI-compliant chess engine. To use it in other UCI-compliant softwares, compile uci.cpp using the instructions above. To see all supported commands, run uci.exe help
The engine contains the following features:
- Search (
v1.0+)- Iterative deepening (
v1.1+) - Aspiration window (
v1.3+) - Aspiration widening (
v3.0+) - Endgame table base
- Iterative deepening (
- Alpha-beta search (
v1.0+)- Pruning (
v1.0+)- Alpha-beta pruning (
v1.0+) - Transposition table cutoff (
v1.1+) - Mate distance pruning (
v1.6+) - Reverse futility pruning (
v2.2+) - Null move pruning (
v2.2+) - Razoring (
v2.3+) - Probcut
- Late move pruning (
v2.3+) - Futility pruning (
v2.3+) - SEE pruning (
v2.3+) - History pruning
- Multi-cut
- Improving heuristics
- Alpha-beta pruning (
- Transposition table (
v1.1+)- Prefetching (
v2.2+) - Aging (
v3.0+) - Clusters
- Storing static evaluations
- Prefetching (
- Principle variation search (
v2.1+) - Extensions (
v1.4+)Check extensions(v1.4+)Pawn push extensions(v1.4+)One reply extensions(v1.7+)- Singular extensions (
v3.0+) - Double extensions (
v3.0+) - Triple extensions
- Negative extensions (
v3.0+) - Cutnode negative extensions (
v3.1+) - Low depth singular extensions
- Reductions (
v1.5+)- Late move reductions (
v1.5+) - Internal iterative reduction (
v3.0+)
- Late move reductions (
- Move ordering (
v1.0+)- MVV-LVA (
v1.0+) - Promotions (
v1.0+) - Hash move (
v1.6+) - Killer heuristics (
v1.3+) - Butterfly history (
v1.5+) - Capture history (
v2.3+) - Piece-to history
- Continuation history
- Correction history
- Threats in history
- SEE (
v1.7+)
- MVV-LVA (
- Pruning (
- Quiescence search (
v1.0+)Delta pruning(v2.1+)- Futility pruning (
v2.3+) - SEE pruning (
v2.3+) - Transposition table cutoff (
v3.0+)
- Evaluation (
v1.0+)- Hand-crafted evaluation (
v1.0+)- Materials (
v1.0+) - Piece-square tables (
v1.0+) - Midgame King safety
- Endgame King opposition
- Endgame King proximity (
v1.0+) - Evaluation tapering (
v1.0+) - Passed Pawn (
v1.3+) - Isolated Pawn (
v1.3+) - Mobility (
v1.5+) - Bishop pair (
v1.8+) - Bishop-colored corner (
v1.8+) - Draw evaluation (
v1.8+) - Evaluation texel tuning (
v1.8+)
- Materials (
- NNUE (
v2.0+)- Lizard SCReLU (
v2.0+) - Lazy updates (
v2.1+) - Horizontal mirroring (
v3.1+) - Output buckets (
v3.1+) - King buckets
- Finny tables
- Pairwise multiplication
- Dual activations
- Lizard SCReLU (
- Hand-crafted evaluation (
- Time management (
v1.0+)- Hard/soft limit (
v3.0+) - Node-based scaling
- Bestmove stability
- Score stability
- Complexity
- Hard/soft limit (
- Pondering (
v1.2+) - Performance (
v1.8+)- Compiler optimizations (
v1.8+) - Incremental selection sort (
v2.2+) - Linux huge pages (
v2.2+) - Staged movegen (
v3.0+)
- Compiler optimizations (
- Lazy SMP
- SPSA tuning
For a more in-depth documentation on the NNUE and how it was trained, refer to the NNUE History. All iterations of Raphael's NNUE were trained on self-generated training data. The net files can be found on the Raphael-Net repository.
Raphael uses or has used the following tools throughout its development:
- fastchess for running SPRTs locally
- C++ chess library for movegen up until v2.3, and a strong source of inspiration for the custom movegen logic from v3.0 onwards
- GediminasMasaitis's Texel Tuner for tuning the HCE parameters for v1.8
- OpenBench for data generations and distributed SPRTs from v3.1 onwards
- bullet for NNUE training from v3.1 onwards
- Pawnocchio for data processing and relabeling from v3.1 onwards
- incbin for embedding network files from v3.1 onwards
Furthermore, the following individuals have inspired me or have helped me tremendously throughout the development process of Raphael (in no particular order):
- Sebastian Lague for inspiring me to start the development of Raphael through the Coding Adventures series
- Jonathan Hallström, author of Pawnocchio (and a contributor to Raphael!!)
- Ciecke, author of Stormphrax
- Sp00ph, author of Icarus
- and many others on the Stockfish and AlphaBeta Discord servers
