Avalanche is the first and strongest UCI Chess Engine written in Zig
Estimated Development ELO (v1.4.0): ~3060
Official CCRL ELO (v1.2.0): 3043
Avalanche is the first and strongest chess engine written in the Zig programming language, proving Zig's ability to succeed in real-world, competitive applications.
This is my second attempt at computer chess, after dropping development of my MiniShogi (五将棋) engine.
Avalanche v1.2.0 was the sole winner of the 96th CCRL Amateur Series Tournament (Division 5), having a score of 27.0/44. See Tournament Page.
Avalanche uses the new NNUE (Efficiently Updatable Neural Network) technology for its evaluation.
This project isn't possible without the help of the Zig community, since this is the first and only Zig code I've ever written. Thank you!
Good Old MIT License. In short, feel free to use this program anywhere, but please credit this repository somewhere in your project :)
zig build -Drelease-fast
Avalanche is only guaranteed to compile using master branch of Zig.
Avalanche also has a lichess account: https://lichess.org/@/IceBurnEngine
Parameter Tuning is done by my Storming Tune script.
-
Dan Ellis Echavarria for writing the github action CI :D
-
https://www.chessprogramming.org/ for explanation on everything I need, including search, tt, pruning, reductions... everything.
-
https://github.com/nkarve/surge for movegen inspiration.
-
Maksim Korzh, https://www.youtube.com/channel/UCB9-prLkPwgvlKKqDgXhsMQ for getting me started on chess programming.
-
https://github.com/dsekercioglu/blackmarlin for NNUE structure and trainer skeleton
-
https://openai.com/dall-e-2/ for generating the beautiful logo image
- General
- This is the first released chess engine written in the Zig Programming Language. Although there are Zig libraries for chess, Avalanche is completely stand-alone and does not use any external libraries.
- Move Generator
- Algorithm is inspired by Surge, but code is 100% hand-written in Zig.
- Search
- Avalanche has a simple Search written 100% by myself, but is probably a subset of many other engines. Some ideas are borrowed from other chess engines as in comments. However many ideas and parameters are tuned manually and automatically using my own scripts.
- Evaluation
- The Hand-Crafted Evaluation is based on https://www.chessprogramming.org/PeSTO%27s_Evaluation_Function, however it is no longer Avalanche's main evaluation.
- NNUE is trained with a private, significantly modified fork of https://github.com/dsekercioglu/marlinflow and the data is generated through self-play games. I hope to make it public in the future.
- UCI Interface/Communication code
- 100% original
-
- Search Improvements
- Countermove heuristic fix
- Tuning
-
- Stronger Neural Network trained on 2GB of data
- Countermove Heuristics
- Higher bounds for History Heuristics
- Improved Aspiration Window
-
- Movegen Bug fixes
- Tuned Search parameters
- Search Rewrite
- Better SEE
- Stronger Neural Network (depth 8, 500 epoch) featuring 8 buckets
-
- NNUE Optimizations
- Singular Extension / MultiCut
- More Aggressive Prunings
-
- Faster Movegen: heavily inspired by Surge
- Complete Core Rewrite
- 512-neuron NNUE trained on 50 million positions on depth 4
-
- Bug fixes
- LMR tuning
- New SEE algorithm
- Aspiration Windows
-
- Bug fixes
- UCI options
- Improvements on Search
-
- History heuristics, killer heuristics
- Better LMR
- Reversed Futility Pruning
- Null Move Pruning
- Razoring
- Time management
- Better Transposition Table
- Static Exchange Evaluation
- Stronger NNUE network: Flake 2
- Trained on human games on https://database.lichess.org/ and more engine games.
- Trained on one million endgame positions
- 728 -> dense -> 512 -> clipped_relu -> 512 -> dense -> 1 + PSQT
-
- Efficiently Updatable Neural Network trained on top-level engine tournaments
- Current model: 728 -> dense -> 128 -> clipped_relu -> 128 -> dense -> 5 + PSQT
- Forward Pass
- Tuned LMR
- Bishop pair, doubled pawns, etc.
- Efficiently Updatable Neural Network trained on top-level engine tournaments
-
- Bitboard board representation
- Magic bitboards
- Negamax Search with Alpha-Beta pruning
- Quiescence Search with stand-pat pruning
- MVV_LVA
- LMR
- HCE PSQT Evaluation