‹Back


weechess-rs

  Source

$ cargo run --release 

Usage: weechess [COMMAND]

Commands:
  display   Print out the board in a human-readable format
  evaluate  Evaluate a position
  perft     Count strictly legal moves to a certain depth
  repl      Start an interactive REPL session with the engine
  uci       Start a UCI client
  version   Print out the version of the engine
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

About

Previously, I built a chess engine.

It was pretty good, but there were some design decisions I had made that had become less than ideal once I started trying to optimize search. For example, I had no concept of a pseudo-legal move, which is cheaper to generate than a strictly legal move because you don’t need to check if making that move would put the king in check. If you can generate pseudo-legal moves then you can include them in the search tree, only promoting them to a strictly legal move if you actually want to search that branch.

In addition to wanting to improve the performance and design of the engine, I also wanted to learn Rust, and this was a great opportunity to do so, having a pretty good idea of what I wanted to build.

Improvements

This version of the engine turned out measurably better than the previous one. It supports all the search features of the previous engine, plus some more nifty improvements:

This engine spanks the previous one in games. I also setup some tooling to compare versions of the engine against each other, which has helped me tweak and improve the evaluation functions some.

Thoughts on Rust

There are no novel takes on Rust anymore, but I will share mine:

It took me a few tries to really get the hang of Rust, but hey, it took me a few tries to get into The Office (US) too.