Avalanche is the first and strongest UCI Chess Engine written in Zig
Official 40/15 CCRL ELO (v2.1.0): 3322
Official Blitz CCRL ELO (v2.1.0): 3399
Version 2.1.0 participated in TCEC Swiss 6.
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.4.0 was the sole winner of the 102nd CCRL Amateur Series Tournament (Division 5), having a score of 29.5/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 Zig v0.10.x. Newer versions will not work as Avalanche still uses Stage1.
Avalanche also has a lichess account (though not often played): https://lichess.org/@/IceBurnEngine
Avalanche follows the UCI protocol and is not a full chess application. You should use Avalanche with a UCI-compatible GUI interface. If you need to use the CLI, make sure to send \n at the end of your input (^\n on windows command prompt).
-
Dan Ellis Echavarria for writing the github action CI and helping me with Zig questions
-
Ciekce for guiding me with migrating to the new Marlinflow and answering my stupid questions related to NNUE
-
Many other developers in the computer chess community for guiding me through new things like SPRT testing.
-
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 (1.5.0 and older)
-
https://github.com/Disservin/Smallbrain and https://github.com/cosmobobak/viridithas for search ideas
-
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 with adaptation to endgames. The HCE is only activated at late endgames when finding checkmate against a lone king is needed.
- NNUE since 2.0.0 is trained with https://github.com/jw1912/bullet
- The NNUE data since 2.0.0 is purely generated from self-play games. Currently, the latest dev network is trained on 600 million self-play positions at depth 8.
- UCI Interface/Communication code
- 100% original
![Logo 2](https://private-user-images.githubusercontent.com/66022611/275379843-cf099f87-91ad-4fd9-a2c3-177b790cd59e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MDgzNjIsIm5iZiI6MTcyNDUwODA2MiwicGF0aCI6Ii82NjAyMjYxMS8yNzUzNzk4NDMtY2YwOTlmODctOTFhZC00ZmQ5LWEyYzMtMTc3Yjc5MGNkNTllLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE0MDEwMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI2ZWU3OGUyOGM4YjE3ODk5ZWE0NjdjODMzOWEzMDc5YTcyYTgwYmY2ZGE2MmI3OTlkYWY1YzExMWZjYmEwZDQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0._YHkmtIDs6OVL84Z3vv9-vjz7dttlbG6loi_rBigXvs)
![Logo 3](https://private-user-images.githubusercontent.com/66022611/275379957-6ece76d4-ce7c-43e7-8321-27e368b12760.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MDgzNjIsIm5iZiI6MTcyNDUwODA2MiwicGF0aCI6Ii82NjAyMjYxMS8yNzUzNzk5NTctNmVjZTc2ZDQtY2U3Yy00M2U3LTgzMjEtMjdlMzY4YjEyNzYwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDE0MDEwMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIzOWNhMmM3MWI2NjhiODI5Y2M2MzFhYWQ2ZWJmZTJjNzVkODhkNjVmZmNkN2E2YWY1YjBlNmNjN2I3Mjg4ZDgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.q5--JQ3FizH8atQtgyTIMGrUN-l7n8TYzweVjDfjOBY)
![Logo 4](https://private-user-images.githubusercontent.com/66022611/275379995-ef77edf1-9f8d-45dc-867f-533a4c84d22f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MDgzNjIsIm5iZiI6MTcyNDUwODA2MiwicGF0aCI6Ii82NjAyMjYxMS8yNzUzNzk5OTUtZWY3N2VkZjEtOWY4ZC00NWRjLTg2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