mkd / gargantua

UCI chess engine with NNUE evaluation
GNU General Public License v3.0
2 stars 1 forks source link
bitboard-chess-engine chess chess-engine cplusplus neural-networks nnue

Overview

Gargantua is a UCI chess engine with NNUE evaluation, derived from Chess0, and inspired by Code Monkey King's BBC.

Gargantua's current approximate ELO rating is around ~3100, based on the Elometer test, various tournaments against other rated chess engines, and a series of online games played on the Free Internet Chess Server (FICS).

Files

This distribution of Gargantua consists of the following files:

Building Gargantua

The default Makefile in src contains the instructions to build Gargantua, with build targets for macOS, GNU/Linux, Unix systems in general, as well as Windows 64-bit.

Using Gargantua

Thanks to the UCI protocol, you can use Gargantua with your favorite chess GUI. Chess GUI applications use the UCI protocol to communicate with the engine, so you can analyze your games, play against it or even run a computer chess tournament from your own computer.

I personally use ScidvsMac (a version of ScidvsPC for Mac) to test Gargantua. There's a ton of free chess graphical interfaces for UCI chess engines, just pick your favorite one.

Gargantua also has a few built-in commands that are not officially part of the UCI protocol. These commands are used for debugging or testing. Here's a short list:

Implementation

Gargantua is implemented mainly in C++, leveraging the STL as much as possible. However, there are many routines and data structures that are written in pure C language for performance reasons.

Gargantua relies on Stockfish' neural networks (NNUE) to evaluate the score of a given position. This is based on Daniel Shawul's NNUE-probe implementation.

In order to ensure a proper behavior, you need to make sure the neural network file (i.e., nn-eba324f53044.nnue) is in the current directory of execution. This also means you must configure the path to Gargantua in your GUI, so that it can find the neural network evaluation file. Otherwise, the engine will play random moves.

Contributing to Gargantua

My work on Gargantua is very sporadic and not a priority in my life, so the development is not very active. So, if you have tried Gargantua and would like to improve the current source code in any way, please go ahead!

Search features and optimizations

Testing new features

Every time a new feature is added to the codebase, with the goal of improving Gargantua's playing strength, it needs to be tested against the latest stable version (master branch). The goal of the test is to see whether the improvement makes the engine stronger or weaker at gameplay.

Testing a new improvement consists of three steps:

  1. Run benchmark.py to test the search speed and time-to-depth
  2. Run benchmark.py to see whether the number of nodes searched drops
  3. Play 300 games with TC 5min per side (0 increment); using a varied opening book (gm2600.bin), for opening variability, that comes pre-installed in Scid vs. Mac.

In some cases, the number of nodes searched and the search speed might become worse than in the master version, yet the play quality might increase considerably (e.g., when adding a search extension that improves gameplay). In this case, the version that plays better (winner of the games) is chosen over the other one.