Both a UCI Chess Engine (Raphael) and a Chess GUI (to play against Raphael or to make Raphael play itself), coded in C++, using SFML and Disservin's Chess Library.
Raphael is a hobby project that is still a work in progress, but it will be updated as time goes by. It is nowhere near as competitive as some of the other chess engines out there, but it is strong enough to beat most humans with ease. Please scroll to the bottom to see a list of features currently implemented
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.
Note: v1.7 will be the last of the minor releases to Raphael. The next major release will be v2.0 using a custom NNUE evaluation function.
Estimated CCRL 40/2 ELO: 1865
To estimate Raphael's ELO, I paired it up against several other engines in a 10 rounds 40/2 gauntlet tournament inside of Arena, incrementally updating Raphael's ELO using the this calculator, which is based on the statistical model between win probability and ELO.
Raphaelv1.7 was matched against Sayuri (1838), Claudia (1908), and BeLL (1939), and the results were a WDL of 8-1-1 (+81), 4-1-5 (-1), and 3-2-5 (-12), respectively. Previously, the ELO of Raphaelv1.6 was estimated to be around 1797, thus the estimated ELO of Raphaelv1.7 is around 1865.
Note that this method of ELO estimation is very crude, as it only only compares against a few other engines with only 10 rounds. In the future, I will conduct a more thorough comparison (maybe once v2.0 is out).
Past ELOs
Version | CCRL 40/2 |
---|---|
1.7 | 1865 |
1.6 | 1797 |
1.5 | 1764 |
Builds for Windows are available on the Releases page. To compile it on your own, run
g++ -c uci.cpp -Isrc -Ichess-library/src -ISFML-2.6.0/include -DSFML_STATIC
g++ -o Raphael uci.o -LSFML-2.6.0/lib -lsfml-graphics-s & del uci.o
Follow these steps to compile Raphael along with the GUI. This is recommended as you do not need an external UCI-compliant GUI to run Raphael.
-
Clone the repository with
git clone https://github.com/Orbital-Web/Raphael.git --recurse-submodules
-
Download SFML-2.6.0 and add it to the root directory
-
Copy
openal32.dll
fromSFML-2.6.0/bin/
and add it to the root directory -
Compile and run
main.exe
with the following commands (optionally, compile with the-DMUTEEVAL
flag to mute evaluations)g++ -c main.cpp -Isrc -Ichess-library/src -ISFML-2.6.0/include -DSFML_STATIC g++ -o main main.o -LSFML-2.6.0/lib -lsfml-graphics-s -lsfml-window-s -lsfml-audio-s -lsfml-system-s -lopengl32 -lfreetype -lwinmm -lgdi32 -lopenal32 -lflac -lvorbisenc -lvorbisfile -lvorbis -logg & del main.o main.exe human "Human" Raphael "Raphael" -s "game.pgn"
-
See other features with
main.exe -help
Note: the compilation process should be similar for other OS, though Raphael was built primarily for Windows, and thus the code has not been tested on other OS. Nonetheless, please refer to the official SFML documentation on how to download SFML for your OS
The game engine is a combination of GameEngine.hpp
, GamePlayer.hpp
, and HumanPlayer.hpp
. It is a GUI-based chess game engine (not to be confused with a chess engine) which lets the user interactively play chess.
If using a human player, the user may annotate the board with arrows and select/play moves similarly to other chess GUIs. The user may also specify the number of rounds, different time controls, starting positions (with fens), and even swap out the players (e.g., with different versions of Raphael).
To use it, refer to the setup instructions above, and run the command main.exe -help
in the command line.
Raphael is a UCI-compliant chess engine that comes with this project. 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|movetime|infinite]
. Pondering is not implemented yet. The engine contains the following features:
- Alpha-beta pruning (
v1.0+
) - Move ordering (
v1.0+
) - Transposition table (fix) (
v1.1+
) - Iterative deepening (fix) (
v1.1+
) - Aspiration window (
v1.3+
) - Opening book
- Endgame table
- Quiescence with captures (
v1.0+
) - Quiescence with queening
- Time management (
v1.0+
) - Skip search on stable pv (
v1.6+
) - Pondering (
v1.2+
) - Pondering with pv (
v1.6+
) - Check extensions (
v1.4+
) - Passed pawn extensions (
v1.4+
) - One reply extensions (
v1.7+
) - Late move reductions (
v1.5+
) - Mate distance pruning (
v1.6+
) - SEE pruning (
v1.7+
) - Lazy SMP
- Materials (
v1.0+
) - Piece-square tables (
v1.0+
) - Midgame King safety
- Endgame King proximity (
v1.0+
) - Evaluation tapering (
v1.0+
) - Passed Pawn (
v1.3+
) - Isolated Pawn (
v1.3+
) - Mobility (
v1.5+
) - NNUE
- MVV-LVA (
v1.0+
) - Promotions (
v1.0+
) - Hash move (
v1.6+
) - Killer heuristics (
v1.3+
) - History heuristics (
v1.5+
) - SEE (
v1.7+
)
Below is the result of each new version against v1.0
out of 400 matches (20 seconds each), starting from a different position (within a ±300 centipawn stockfish evaluation) and alternating between playing as white and black.
v1.0
v1.0 [177 / 34 / 189]
v1.1
v1.0 [245 / 39 / 116]
v1.2
v1.0 [253 / 34 / 113]
v1.3
v1.0 [301 / 23 / 76]
v1.4
v1.0 [333 / 25 / 42]
v1.5
v1.0 [344 / 23 / 33]
v1.6
v1.0 [355 / 27 / 18]
v1.7
v1.0 [374 / 20 / 6]
And below are the more detailed comparisons.
Player | Wins | Draws | Losses | Opponent | ||||
---|---|---|---|---|---|---|---|---|
White | Black | Timeout | White | Black | Timeout | |||
v1.0 | 91 | 70 | 16 | 34 | 92 | 70 | 27 | v1.0 |
v1.1 | 94 | 104 | 47 | 39 | 53 | 63 | 0 | v1.0 |
v1.2 | 115 | 104 | 34 | 34 | 62 | 51 | 0 | v1.0 |
v1.2 | 112 | 96 | 6 | 30 | 86 | 61 | 9 | v1.1 |
v1.3 | 144 | 120 | 37 | 23 | 43 | 32 | 1 | v1.0 |
v1.3 | 107 | 107 | 10 | 38 | 61 | 61 | 16 | v1.2 |
v1.4 | 144 | 136 | 53 | 25 | 14 | 27 | 1 | v1.0 |
v1.4 | 117 | 114 | 13 | 40 | 57 | 49 | 10 | v1.3 |
v1.5 | 156 | 154 | 34 | 23 | 15 | 18 | 0 | v1.0 |
v1.5 | 99 | 99 | 13 | 62 | 61 | 60 | 6 | v1.4 |
v1.6 | 169 | 178 | 8 | 27 | 5 | 13 | 0 | v1.0 |
v1.6 | 122 | 127 | 2 | 77 | 33 | 39 | 0 | v1.5 |
v1.7 | 182 | 187 | 5 | 20 | 2 | 4 | 0 | v1.0 |
v1.7 | 92 | 98 | 0 | 108 | 53 | 49 | 0 | v1.6 |
Note: a timeout usually means that the game was relatively equal