/rice-fork

C++ UCI Chess Engine

Primary LanguageC++GNU General Public License v3.0GPL-3.0

Rice logo by Midjourney

strong, free and open source UCI chess engine written in C++.

Overview

Rice is a powerful NNUE chess engine that combines the use of alpha-beta search with various other search techniques to achieve its impressive performance.

Features

Board Representation

  • Bitboards
  • Fancy magics for movegen

Search

  • Negamax
  • Alpha beta pruning
  • Quiescence search
  • Null move pruning (NMP)
  • Static null move pruning aka Reverse Futility Pruning
  • PVS (Principal Variation Search)
  • ZWS (Zero Window Search)
  • LMR (Late Move Reduction)
  • SEE Pruning (Static Exchange Evaluation Pruning)
  • Movecount Pruning/LMP (Late Move Pruning)
  • Transposition Table cutoffs and move ordering
  • History, killers and MVVLVA Move ordering
  • Search Extensions

Evaluation

  • NNUE (Efficiently updateable neural network)
  • Net Architecture: 768 inputs with 4 buckets, 1 hidden layer of 768 size, perspective aware.
  • NNUE Trainer: Grapheus by Luecx
  • Old trainer: marlinflow

Building

Default build (g++):

git clone https://github.com/rafid-dev/rice
cd rice/src
make 
./Rice

Clang build:

git clone https://github.com/rafid-dev/rice
cd rice/src
make CXX=clang++
./Rice

Usage

The Universal Chess Interface (UCI) is a standard protocol used to communicate with a chess engine, and is the recommended way to do so for typical graphical user interfaces (GUI) or chess tools. Rice requires a UCI-compatible graphical user interface in order to be used with the protocol.

NNUE Background

From 5.0, Rice has switched to NNUE from its handcrafted evaluation.

When I lack the hardware resources to generate enough training data, I need to use data generated by external engines. However, I think it's important to be transparent about the use of these engines and where the training data comes from.

Rice 5.0 has used data generated by Viridithas, a strong chess engine by Cosmo.

Leela Chess Zero by the Lc0 Team

LC0 employs a novel method for playing high-level chess by utilizing MCTS and acquiring its chess knowledge through self-play. As Rice 6.0 and onwards utilizes data from LC0, it is worth noting that this data is licensed under the Open Database License, which promotes the sharing and reuse of data while maintaining legal protection for contributors and users.

Special thanks to:

  • Runpod for providing the GPU hardware to train Rice's neural networks.
  • Andrew Grant , author of Ethereal for his clear and concise code which led to better understanding. I also thank him for contributing threads for the development of Rice.
  • Disservin, author of Smallbrain for his chess library in c++ which is used in Rice.
  • Luecx, author of Koivisto for his enormous help for implementation of NNUE

Acknowledgements: