Skip to content

dannyhammer/toad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toad 🐸 A UCI-compatible toy chess engine

Toad is a work-in-progress chess engine, and serves as my personal excuse to write fun code in Rust. It was originally built upon my chessie crate, which is a chess library that handles board representation, move generation and all other rules of chess. Development progress is recorded automatically in the changelog. All progression/non-regression testing is done through OpenBench instance hosted here. Strength of the latest version can be found on the CCRL pages- just search for Toad!

Up for a game? Play against Toad on Lichess!

Overview

Being a chess engine, Toad is CLI application that, by default, will await commands via stdin. Toad does not have a GUI. There are some commands you can use to view the board state and make moves, but Toad's primary use case is to be paired with a GUI or match runner like en croissant or cutechess. For convenience, you can run any of Toad's commands on startup and Toad will exit immediately after that command's execution. To run multiple commands on startup, pass them in with the -c "<command>" flag. You can pass in the --no-exit flag to continue execution after the command(s) have finished executing. Run the engine and execute the help command to see a list of available commands, and --help to view all CLI flags and arguments.

UCI Commands

Toad abides (mostly) by the Universal Chess Interface protocol, and communicates through stdin and stdout. The parsing of UCI commands and responses is handled by my uci-parser crate.

The following UCI commands (and arguments) are supported:

  • uci
  • debug [ on | off ]
  • isready
  • setoption name <x> [value <y>]
  • ucinewgame
  • position [fen <fenstring> | startpos] [moves <move_1> ... <move_i>]
  • go wtime <x> btime <x> winc <x> binc <x> depth <x> nodes <x> movetime <x> infinite
    • Extended to include go perft <x>
  • stop
  • quit

Custom Commands

In addition to the above UCI commands, Toad also supports the following custom commands:

Commands:
  await          Await the current search, blocking until it completes
  bench          Run a benchmark with the provided parameters
  changevariant  Change the variant of chess being played, or display the current variant
  display        Print a visual representation of the current board state
  eval           Print an evaluation of the current position
  exit           Quit the engine
  fen            Generate and print a FEN string for the current position
  flip           Flips the side-to-move. Equivalent to playing a nullmove
  hashinfo       Display information about the current hash table(s) in the engine
  makemove       Apply the provided move to the game, if possible
  moves          Shows all legal moves in the current position, or for a specific piece
  option         Display the current value of the specified option
  perft          Performs a perft on the current position at the supplied depth, printing total node count
  psqt           Outputs the Piece-Square table value for the provided piece at the provided square, scaled with the endgame weight
  splitperft     Performs a split perft on the current position at the supplied depth
  help           Print this message or the help of the given subcommand(s)

For specifics on how a command works, run toad <COMMAND> --help

UCI Options

Name Values Default Description
Clear Hash Clear the hash table(s)
Hash 1..=1024 16 Set the size (in MB) of the hash table(s)
Threads 1..=1 1 Only implemented for use with OpenBench
UCI_Chess960 true, false false Enable support for Chess960

Running

To run Toad, head over to the releases page to grab the latest pre-compiled release for your platform. Alternatively, you can build from source:

  1. Ensure you have Rust and Cargo installed.
  2. Clone this repository:
    git clone git@github.com:dannyhammer/toad.git
  3. Build and run!
    cargo run --release
    or run make to generate an executable named toad-<version>.
    make
    ./toad-<version>

Note: Development has primarily been done on Linux (Ubuntu 22.04), with minimal testing on Windows 10 and no testing on MacOS. If you are willing to test the installation and execution of Toad on other operating systems, please provide feedback!

Features

More features will be added as development continues! You can see most of my future plans in the backlog.

Acknowledgements

More people have helped me on this journey than I can track, but I'll name a few notable resources/people here: