Chimp is a UCI-compatible chess engine following a depth-first search approach. It sits at ~2500 elo in its edge build.
Meaning, given a chess position (the root), it generates a move tree and explores as far as possible along each branch before backtracking. The engine searches for the best move to play amongst the root's children, using optimization techniques to efficiently prune branches that are unlikely to lead to favorable outcomes.
- Negamax Search
- Alpha-beta Pruning
- Iterative Deepening
- Move Ordering
- Transposition Table
- MVV-LVA for capture moves
- Killers for quiet moves
- Quiescence Search
- Mate Distance Pruning
- Principal Variation Search
- Material Score
- Piece-Square Tables
- Bishop Pair Bonus
- Mobility Score
- Game Phase Interpolation
Chimp requires the following tools to build and run:
- Compiler:
clang++. - Build System:
make.
To build Chimp, you can run the following commands:
git clone https://github.com/fsoonaye/chimp.git
cd chimp
make
./engineChimp supports the following UCI (Universal Chess Interface) commands:
uci
isready
ucinewgame
quit
stop
position startpos
position fen <fen-string> moves <move1> <move2> ...
go depth <>
go nodes <>
go perft <>
go wtime <> btime <> winc <> binc <> movestogo <>
go movetime <>
go mate <>
eval
Further explanations of these commands can be found in uci.h and on the internet, for instance here or in the official stockfish documentation.
This chess engine is the culmination of my ongoing exploration into the rich and complex niche that is chess programming.
In its current state, Chimp has, for now, absolutely no pretentions of revolutionizing the field of chess programming. Instead, its purpose is to serve as a personal milestone: a proof of my journey and dedication to grasp the fundamentals of this fascinating domain.
I have only implemented techniques and concepts that I believe to understand, one at a time, prioritizing clarity and simplicity. In many ways, this repository embodies the kind of resource I wish I'd had as an entry point.
This project also served as a playground for improving my C++ skills and documenting what I learned. Over time, I’ve built a significant collection of notes. One day, I might turn these notes into a guide to chess programming.
One thing I definitely plan to write soon is a comprehensive guide to chess engine testing. Having all this information gathered in one place and thoroughly explained would have saved me so much time!
While the guides I plan to write are still in progress, here’s a list of useful resources I’ve used or depended on to deepen my knowledge.
- OpenBench: a Distributed SPRT framework.
- CuteChess: a GUI and cli testing tool for engine matches (also the more recent FastChess).
- martinnovaak/enginetest: tests your engine against Lichess puzzles.
- TerjeKir/EngineTests: tests your engine against "mate in x" problems, also has a speed-up comparison tool.
- Chess Programming Wiki: the ultimate reference for everything related to chess engine programming.
- Connorpasta: a practical progression guide for search implementation.
- PeSTO: a reasonable evaluation function when NNUEs are beyond the scope of your engine.
- Stockfish's old Hand-Crafted Evaluation: a (really) advanced evaluation function when NNUEs are beyond the scope of your engine.
- Bruce Moreland's Programming Topics: an older yet remarkably pedagogical resource.
- The art of Chess Programming in Rust: a more modern, well-documented journey into creating a chess engine.
I have annotated concepts and arrays in my source code to properly credit the sources where I’ve borrowed ideas or implementations directly from other engines. However, if I’ve missed an attribution, I encourage the authors of these works to reach out for additional recognition or to request removal, if necessary.
- SmallBrain
- Rice
- Weiss
- Stormphrax
- Stockfish: the strongest open-source chess engine in the world.
- Vice: I have not looked at it for quite some time but I had to give credit.
- The Stockfish Discord Server and mainly the Engine Programming Discord Server, whose active members answered countless questions and helped me progress on this journey.
- Disservin, the author of SmallBrain, for the brilliant Chess Library in C++ used in Chimp (primarily for move generation and board data structures).
- Andrew Grant, the author of OpenBench, for his great framework and his availability on the OpenBench Discord server.