Zahak
A UCI compatible chess AI written in Go. Still work in progress.
Courtesy to the OpenBench community, Zahak is now part of the official
OpenBench instance
The name
Zahak (or Zahhak or Azhi Dahak) is an evil figure in Iranian/Kurdish/Perisan
mythology, evident in ancient Iranian folklore as Azhi Dahāka, the name by
which he also appears in the texts of the Avesta. Legend has it, that he had two
giant snakes on his shoulders and he had to feed them two human brains on
daily basis, you can read more about him
here
Play Zahak online
Zahak is new to LiChess, you can play him and be impressed with him. His
LiChess handle is zahak_engine.
Play Zahak on your Android Phone/Desktop
Zahak is a bare chess engine AI, that means it doesn't come with any GUI
interface. That also means, it is easy to plug it into any chess GUI that
supports UCI protocol.
Tournaments
Zahak recently got invitation to the TCEC tournament!
Zahak is also participating in ZaTour tournament
series for open source and original chess engines.
And many other tournaments, like the ones arranged by the amazing Graham Banks.
Rating
Zahak is in almost all major rating lists, here are the details:
- Other well-known rating lists
Implemented Features:
Core Features
- UCI Support
- (Magic) Bitboards
- Multi-stage move generation
- Transposition Table
- Pawnhash
- PolyGlot opening book
- Compliant with OpenBench
- Syzygy Support
- MultiPV
- Skill Levels, 1 to 7 (strongest)
Search
Basics
- Alpha-Beta search
- Quiescence Search
- Iterative Deepening
- PV Search and PV
- Search with Zero Windows
- Aspiration Window with PVS
- Pondering
- Multi-Threading (LazySMP)
Move Ordering
- Hash move
- Promotions
- Static Exchange Evaluation followed by LVA-MVV for equal captures according to SEE
- Killer Moves Heuristics
- Countermove Heuristics
- Move History Heuristics
- Countermove History Heuristics
- FollowUp History Heuristics
Selectivity
- Late Move Pruning
- Null-Move Pruning
- Delta Pruning
- Reverse Futility Pruning
- Futility Pruning
- Late Move Reduction
- Razoring
- Check Extensions
- Internal Iterative Deepening
- SEE pruning both in QS and normal search
- Threat Pruning
- Singular Extension
- Multi-Cut
Evaluation
Command line options
bash-3.2$ bin/zahak -help
Usage of bin/zahak:
Commands:
./zahak Runs Zahak in UCI mode
./zahak bench Runs Zahak in OpenBench mode
Options:
-book string
Path to openning book in PolyGlot (bin) format
-perft
Provide this to run perft tests
-perft-tree
Run the engine in prefttree mode
-gen-epds
Generate opening EPDs for self-play
-profile
Run the engine in profiling mode
-slow
Run all perft tests, even the very slow tests
-test-positions string
Path to EPD positions, used to test the strength of the engine
Skill Levels
Anchored around Rustic Alpha 3, I found that, based on CCRL the ratings will
probably translate to the following:
- Skill Level 1: 1270
- Skill Level 2: 1440
- Skill Level 3: 1630
- Skill Level 4: 1856
- Skill Level 5: 2004
- Skill Level 6: 2074
Opening Books
Currently only PolyGlot is supported. Then engine doesn't come with any books,
but you can attach your favourite one easily by passing the path to -book
command: zahak -book PATH_TO_BOOK
.
A bunch of free books are available here
Training Networks
Please refer to this guide.
Building
To build the project, simply run make build
, testing with make test
, and running with make run
.
Other features exist, for example you can run perft
with ./zahak -perft
or profile it with ./zahak -profile
.
You can also run it in perfttree mode with ./zahak -preft-tree
.
Contributors
Thanks to the following for their valuable contributions:
- Basti Dangca: for generating data for training Zahak's network
- Alan Cooper (Scally): for generating weaker networks for different skill levels.
Acknowledgement
Zahak wouldn't have been possible without:
- VICE videos
- Chess Programming Wiki
- The official OpenBench instance, and the all the hardware donators (noopwn4ftw and others)
- Aryan Parekh the author of Bit-Genie, who helped me with NNUE
- Niels Abildskov the author of Loki, who helped me with Texel Tuning
- Nasrin Zaza for the amazing logo
- OpenSource engines like: Weiss, Ethereal, CounterGo, Cheng and Berserk (in no specific order)
- OpenBench community on Discord
- No4b for helping me with some evaluation terms