Raphael is a UCI Chess Engine built using C++ and Disservin's Chess Library. It also comes with a GUI built using SFML.
Raphael is a hobby project that is still a work in progress, but it plays decent chess. 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 CCRL Blitz 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 |
|---|---|
| 2.1.0 | 2739* |
| 2.0.0 | 2646* |
| 1.8.0 | 2223* |
| 1.7.6 | 1967 |
| 1.7.0 | 1851 |
| 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.
Please refer to the following section to compile the GUI and/or the engine yourself on Windows and Linux.
With the GUI compiled, you can 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 UCI engine has no command-line arguments.
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 --recurse-submodules
-
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. You can play against Raphael by starting a match against a human player and Raphael engine in the command line (see 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. The UCI engine currently supports the following commands: uci, isready, ucinewgame, stop, quit, position, and go [wtime|btime|winc|binc|depth|nodes|movestogo|movetime|infinite]. Pondering is not implemented yet in the UCI engine, though it does come in the GUI version. The engine contains the following features:
- Endgame table
- Time management (
v1.0+) - Skip search on stable pv (
v1.6+) - Pondering (
v1.2+) - Pondering with pv (
v1.6+)
- Alpha-beta pruning (
v1.0+) - Move ordering (
v1.0+) - Transposition table (
v1.1+) - Quiescence with captures (
v1.0+) - Iterative deepening (
v1.1+) - Aspiration window (
v1.3+) - Check extensions (
v1.4+) - One reply extensions (
v1.7+) - Mate distance pruning (
v1.6+) - Principle variation search (
v2.1+) - Late move reductions (
v1.5+) - Reverse futility pruning
- Null move pruning
- Late move pruning
- Futility pruning
- Internal iterative deepening
- Lazy SMP
- 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 tuning (
v1.8+) - NNUE (
v2.0+) - NNUE lazy updates (
v2.1+) - NNUE output bucket
- MVV-LVA (
v1.0+) - Promotions (
v1.0+) - Hash move (
v1.6+) - Killer heuristics (
v1.3+) - Quiet history (
v1.5+) - Continuation history
- Capture history
- Correction history
- SEE (
v1.7+)
For a more in-depth documentation on the NNUE and how it was trained, refer to the NNUE README. No external engines were used to generate Raphael NNUE's training data.
- Sebastian Lague for inspiring me to start the development of Raphael through the Coding Adventures series
- Disservin for creating the C++ chess library, fastchess, and Python Chess Engine, all of which I've used extensively while developing my engine
- Those on the Stockfish Discord for teaching me and helping me out with the NNUE dataset collection, training, and evaluation, as well as engine development in general. Without their help, I would have been stuck for a very very long time without a positive-ELO NNUE.
