The original Kirin Chess Engine was written in C and the source code is available here. I have since deprecated this project and am now writing the Kirin Chess Engine in Zig.
I write a weekly devlog which you can view at strydr.net. These devlogs are meant to serve as a walk through my thought process while building Kirin, as well as a limited form of documentation of the project.
I am also working on a documentation website for Kirin, which will be available at a subdomain to my website in the coming months.
- Bitboard board representation ✅
- Pre-calculated attack tables ✅
- Magic bitboards ✅
- Encoding moves as a packed struct ✅
- Copy/make approach for making moves ✅
- Pseudolegal move generation with immediate legality testing ✅
- Negamax search with alpha beta pruning
- PV/killer/history move ordering
- Iterative deepening
- PVS (Principle Variation Search)
- LMR (Late Move Reduction)
- NMP (Null Move Pruning)
- Razoring
- Evaluation pruning / static null move pruning
- Transposition table (up to 128MB)
- PURE Stockfish NNUE evaluation + 50 move rule penalty
- UCI protocol
Zig is a new programming language that hasn't reached v1.0 at the time of writing this. Because of this, development of the Zig language is constantly ongoing. I currently use the Zig Nightly AUR package which is being consistently updated. There is also a homebrew version of the nightly bin for Mac users.
The Zig build system is super robust and easy to use, here are a few commands you can run, with more to be added down the road:
zig build # Build the project
zig build run # Run Kirin Chess
zig build test # Run tests
zig build perft # Run perft tests
zig build magic # Generate magic numbers
Thank you greatly to Maksim Korzh, without whom I would not have been able to write Kirin. Also, thank you to the people on the Talk Chess forum and the Chess Programming Wiki for putting together resources used in the creation of Kirin.
Also thank you to Hejsil for suggesting that I change the encoding of moves from an integer to a packed struct. This lead me down a rabbit hole of improvements and modifications.