Play against Aramis on Lichess
Aramis is an uci-compliant chess engine that does not have its own GUI. This project has been largely inspired by my previously built python chess engine which I estimate to play around 1400 - 1500 ELO. Thanks to the speed brought by c++ many more optimizations were squeezed in the game-tree search bringing Aramis_v1_3_0 to a rating of 2407 in CCRL Blitz. The latest code for v1.5.0 can be found in the respective branch, though development has been slower due to the demanding computing resources and time required to test new patches, one day I wish to return to this project and aim for higher spots in the global leaderboards. Please contact me for any advice, critique or question about the bot :)
- Running the Engine
- Build Guide
- User Details
- UCI Commands
- Extra-UCI Commands
- Technical Details
- Credits
- Room For Improvement
If you are on windows-x64 or macos-x64 head to the 'Releases' section and download the executable. If you want to build this project, follow the build guide below.
This project uses CMake for build configuration. Before you start, make sure you have the following software installed:
- CMake: Version 3.15 or higher. Download CMake
- Compiler: Ensure you have a C++ compiler installed (GCC, Clang, or MSVC).
- Git: For cloning the repository. Download Git
To get started, clone the repository using the following command:
git clone https://github.com/FedericoSaitta/Chess-Engine-in-cpp
cd ChessEngine
Head to the directory where the repository is located and run:
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
If you want to build the project in debug mode, use -DCMAKE_BUILD_TYPE=Debug .. instead. Note that in Debug mode
a log-file is generated in the working directory and many run-time tests and sanity checks are performed causing the
engine to slow significantly, Debug mode should not be used for play against humans or other engines.
For macOS and Linux: ./ChessEngine
For windows:ChessEngine.exe
position:
startposfenfen moves
go:
depth xperft xwtime x btime x:movetime xwinc x binc xmovestogo x
setoption name Hash value x, by default the hash size is of 256 MegaBytes.
uci, isready, ucinewgame, quit.
bench to run a pre-established search-test suite
moveOrdering to display the pseudo-legal moves in the current position and their relative scores
display to print the current board-state in the terminal
The quoted ELO gains are from SPRT so the figures may not be accurate. SPSA and Texel-Tuning brought over 200 ELO so far.
- Plain Magic Bitboards for all sliding and leaping pieces.
- Pawn pushes, En-Passant and Castling move generation is done on the fly.
- Copy-Restore approach is used to play and undo moves on the board
- Make-UnMake move and full Position class implementation
- Staged move generation
- Legal move generation
- Hand-Crafted-Evaluation tuned with Texel tuner
- Tapered evaluation which considers piece position on the board, and their mobility
- Rooks and Queens gain bonuses for being on semi-open and open files
- King evaluation:
- semi-open and open file malus (+10)
- pawn-shield bonus (+10)
- Pawn evaluation:
- isolated, passed and double pawns (+40)
- pawn phalanx and protected pawns (+20)
- unstoppable passer
- Quiescence search
- Iterative deepening
- Principal Variation Search
- Check Extension
- Late Move reductions
- Razoring
- Aspiration windows (+50)
- History malus and gravity (+30)
- Fail-soft Negamax (+20)
- Null Move Pruning (+100)
- Reverse Futility Pruning (+50)
- Delta Pruning (+30)
- Late Move Pruning (+60)
- Transposition table in quiesce (+20)
- SEE pruning in quiesce (+30)
- SEE PVS pruning in negamax (+20)
- SEE move ordering (captures only) (+10)
- Improving heuristic
- 50-move rule and insufficient material draws
- Hard bound given by (Time / 30) + Increment
- Soft bound given by (Time Per Move) / 3
- Best move stability
The Engine matches were run in fast-chess with a book from Fish-Test with positions of 80 cp or less.
| Version | ELO Estimate | CCRL Blitz ELO |
|---|---|---|
| 1.4.0 | 2500 | 2749 |
| 1.3.0 | 2400 | 2407 |
| 1.1.0 | 1800 | ---- |
- Maksim Korzh for his incredible chess programming in c series which was invaluable while implementing bitboard move-generation and transposition table.
- Gediminas Masaitis for his Texel tuner without which the evaluation would be much weaker.
- Sebastian Lague for his chess videos and small-chessbot tournament which sparked my interest in chess programming.
- The Chess Programming Wiki: https://www.chessprogramming.org/Main_Page.
- tissatussa for testing compiles for Linux, using Xubuntu.
- Logical inaccuracies:
- negamax and quiesce classify noisy moves with different criteria, quiet-promotions are scored with history
- tt table and RFP use fail-hard while search is fail-soft
- Simplifications:
- Make/Un-Make brought a negligible speed improvement over Copy/Make though the code is much more complex
- Revert to a simpler move ordering though it loses ELO, to better keep track of which moves lead to pruning
- Search / Eval improvements:
- Plenty of ELO is to be gained with TT bucketing, ageing and replacement schemes.
- Better data generation could lead to better Texel-Tuning
- A few search features in the road-map have not been implemented
- Engine does not understand insufficient material draws
- Possible small bugs within TT.
- Quality of Life improvements:
- nps is 0 when less than 1000 nodes searched
- code coverage should be increased and core functions should have asser statements in key branching points
- uci tests should be written such that new releases work on multiple GUIs
