byte-knight is a UCI compliant chess engine written in Rust. It started as a port of the chess engine I submitted for Sebatian Lague's Chess Engine Challenge where it placed in the top 32 out of 600+ entries.
You can challenge byte-knight yourself on Lichess!
byte-knight is my first "real" Rust project. I'm a long time C++ developer and have been itching to learn Rust. I really enjoyed participating in the chess challenge a while back and thought that writing a new chess engine from scratch would be a good way to learn the language.
byte-knight is a command line chess engine and does not come with any sort of user interface. There are many chess GUIs out there that you can use like cutechess.
New features are tested via my OpenBench intance using SPRT testing.
| Version | CCRL 40/15 | CCRL Blitz | 
|---|---|---|
| 3.0.0 | 2386 | 2307 | 
- Bitboard board representation
- "Magic" bitboards or PEXT for sliding piece attacks
- Zobrist hashing with board state history
- Legal and pseudo-legal move generator
- Iterative deepening
- Negamax with alpha/beta pruning
- Quiescence search
- Transposition Table
- Principle variation search
- Aspiration windows
- Reverse futility pruning
- Late Move Reductions
- Internal Iterative Reductions
- Null Move Pruning
- Late Move Pruning
- Time control
- Basic hard/soft limits
 
- Move ordering
- TT Moves
- MVV/LVA with transposition table priority
- History heuristic with history gravity
 
- Piece square tables with tapered evaluation using PeSTO values.
- Project includes an HCE tuner based on jw1912/hce-tuner
 
UCI is a standard protocol for chess engines. byte-knight implements the following commands:
- uci
- ucinewgame
- isready
- position <fen> moves <move list>
- go- depth <depth>
- nodes <nodes>
- wtime <wtime> btime <btime> winc <winc> binc <binc>
 
- stop
- quit
To see all commands that byte-knight supports, type:
byte-knight helpTo see all options for a given command, type byte-knight <cmd> --help.
- bench- This runs a fixed depth search on a variety of positions. This is used by OpenBench for scaling based on engine performance.
| Name | Value Range | Default | Description | 
|---|---|---|---|
| Hash | [1 - 1024] | 16 | Set the TT table size in MB | 
| Threads | [1] | 1 | How many threads to use in search | 
Clone the repo and run:
cargo run --releaseTo run the full suite of supported tests, benchmarks and other development dependencies, you will need the following tools (in addition to Rust and Cargo):
- just
- Rust llvm-profdata component
- Install with rustup component add llvm-tools-preview
 
- Install with 
- grcov (Used to generate code coverage reports)
- lcov (Required for genhtmlto create HTML reports fromlcovdata)
The project is licensed under the GPL license. See LICENSE for more details.
Thanks/acknowledgement for those who have inspired and helped with this project:
- Sebastian Lague for his chess YouTube vidoes and for hosting a fun coding challenge.
- The Chess Programming Wiki for all the free information. Thank you to all the various authors.
- Analog-Hors for some excellent write ups on chess, especially regarding magic numbers.
- Many members of the Engine Programming discord for helping see how little I really know.
- Danny Hammer for providing feedback, for helping me with troubleshooting my engine and for writing the chessieanduci-parsercrates. Thanks for inspiring some of the techniques and methods used inbyte-knight.
- Marcel Vanthoor for his Rustic engine and associated book.
- Everyone at pyrobench for donating CPU time as well as helping me when I get stuck.
| @DeveloperPaul123 | 
|---|