Skip to content

cosmobobak/viridithas

Repository files navigation

Viridithas, a UCI chess engine written in Rust

Visualisation of Neuron 0 in the 21th-gen Viridithas NNUE

Build License Release Commits

Viridithas is a free and open source chess engine, that as of 2024-08-22 is the strongest chess program written in Rust, and the strongest chess program by a UK author. These claims are based on my own personal tests and aggregate results from multiple public rating lists. If these claims are no longer true, it's likely due to the hard work of some of my friends in the chess-programming community, most likely the authors of Stormphrax & Black Marlin. The Viridithas project prides itself on using original training data for its neural networks.

Viridithas is a command-line program that can be used from the terminal or can communicate with a graphical user interface over the UCI protocol.

For an overview of the features of Viridithas, see the viri-wiki.

Building Viridithas

If you just want one of the official releases of Viridithas, check out the Releases tab on the right. If you want to build a specific version of Viridithas from source (say, the latest and greatest master commit) then follow these instructions:

  1. Before following any of these instructions, make sure you have Rust installed. You may also need to install the clang C compiler for tablebase probing support.

  2. Clone this repository to your machine via git clone https://github.com/cosmobobak/viridithas.

  3. Enter the source directory via cd viridithas.

  4. (optional, likely unnecessary) select the branch you'd like to compile via git checkout <BRANCH_NAME>.

  5. Download the corresponding neural network for the version of Viridithas that you are compiling and save it in the source root as viridithas.nnue. All of Viridithas's neural networks can be found in the releases of the viridithas-networks repo. Networks are stored seperately from this repo due to file-size considerations.

    If you just want the latest neural net, you can download it with the command curl -s "https://api.github.com/repos/cosmobobak/viridithas-networks/releases/latest" | grep -o '"browser_download_url": "[^"]*' | awk -F'"' '{print $4}' | xargs -L 1 wget -O viridithas.nnue.zst.

  6. Build Viridithas.

    On Windows, run

    > $env:RUSTFLAGS="-C target-cpu=native"
    > cargo b -r --features syzygy,bindgen
    

    On Linux, run

    > RUSTFLAGS="-C target-cpu=native" cargo b -r --features syzygy,bindgen
    

    You now have a fully-functional version of Viridithas at the path target/release/viridithas.

Evaluation Development History/Originality (HCE/NNUE)

  • First evaluation was a simple piece value / psqt table approach, using values from PeSTO. (as far as I remember)
  • Early in development, a local-search texel tuning module was developed, and trained on the Lichess Elite dataset, removing the PeSTO values with increased strength.
  • Many new evaluation terms were added during development, and were continually re-tuned on Viridithas's self-play games.
  • The first NNUE was trained on a dataset of games played by Viridithas 2.7.0, 2.6.0, and 2.5.0, all rescored with a development version of Viridithas 2.7.0 at low depth.
  • Subsequent networks were trained on additional self-play games by subsequent versions of Viridithas. The 13th-generation network, and many since, include positions from the Lichess Elite dataset rescored by Viridithas.
  • Between versions 7.0.0 and 8.0.0, original datagen code was written that allows Viridithas to generate data without need for an opening book to ensure game variety, resulting in even greater strength of play.

All neural networks currently used in the development of Viridithas are trained exclusively on its own self-play games, and no network has ever been trained on the output of an engine other than Viridithas.

Thanks and Acknowledgements

python-chess, without which I would never have been able to gain a love for chess programming.

The VICE video series, which was invaluable for explaining how various chess engine concepts can be implemented.

Andrew Grant's Ethereal, the exceedingly clear code of which helped me realise several horrible flaws in Viridithas.

weather-factory, which I used only minimally, but which is still responsible for about ~10 elo in Viridithas.

marlinflow, was responsible for neural network training for Viridithas up until version 11.0.0.

bullet, which I have used for neural network training in the development of Viridithas since version 11.0.0.

The SweHosting OpenBench Instance, which is invaluable in testing new patches and features.