Skip to content

A UCI compliant chess engine, written in Rust.

License

Notifications You must be signed in to change notification settings

DeveloperPaul123/byte-knight

Repository files navigation

byte-knight

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.

Overview

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.

Features

Board/Game Representation

  • Bitboard board representation
  • Magic bitboards for sliding piece attacks
  • Zobrist hashing with board state history
  • Legal move generator

Search

Evaluation

  • Piece square tables with tapered evaluation using PeSTO values.

UCI

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

Other Commands

To see all commands that byte-knight supports, type:

byte-knight help

To 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.

UCI Options

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

Build and Run

Clone the repo and run:

cargo run --release

License

The project is licensed under the GPL license. See LICENSE for more details.

Credits

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 chessie and uci-parser crates. Thanks for inspiring some of the techniques and methods used in byte-knight.
  • Marcel Vanthoor for his Rustic engine and associated book.

Author


@DeveloperPaul123