Smallbrain icon indicating copy to clipboard operation
Smallbrain copied to clipboard

A UCI chess engine written in C++

Smallbrain

History

During the pandemic I rediscovered chess and played a lot of games with my friends.
Then I started to program my first engine python-smallbrain in python, with the help of python-chess.

I quickly realized how slow python is for chess engine programming, so I started to learn C++.
My first try was cppsmallbrain, though after some time I found the code very buggy and ugly.
So I started Smallbrain from scratch, during that time, I also joined Stockfish development.

After some time I began implementing a NNUE into Smallbrain, with the help of Luecx from Koivisto.
As of now Smallbrain has a NNUE trained on data given to me by Luecx, while using his trainer. In the future I plan to generate my own data.

Compile

Compile it using the Makefile in ./src or use the VS Solution (which is only maintained from time to time)

make
.\smallbrain_5.0.exe bench

compare the Bench with the Bench in the commit messages, they should be the same.

UCI settings

  • Hash
    The size of the hash table in MB.

  • Threads
    The number of threads used for search.

  • EvalFile
    The neural net used for the evaluation,
    currently only default.nnue exist.

Engine specific commands

  • go perft depth
    calculates perft from a set position up to depth.

  • print
    prints the current board

  • captures
    prints all legal captures for a set position.

  • moves
    prints all legal moves for a set position.

  • rep
    checks for threefold repetition in a position

  • eval
    prints the evaluation of the board.

  • perft
    tests all perft position.

Elo

CCRL 40/15

  Name                  Elo      +       -
  Smallbrain 5.0 64-bit	3136	+23	−23
  Smallbrain 4.0 64-bit	2980	+26	−26
  Smallbrain 2.0 64-bit	2268	+30	−30
  Smallbrain 1.1 64-bit	2223	+29	−30

CCRL Blitz 2'+1" (Blitz)

  Name                  Elo      +       -
  Smallbrain 5.0 64-bit	3194	+30	−30
  Smallbrain 4.0 64-bit	3004	+18	−18
  Smallbrain 3.0 64-bit	2925	+25	−25
  Smallbrain 1.1 64-bit	2174	+21	−21

Features

  • Engine
    • Bitboard representation
  • Evaluation
    • NNUE 768 Input -> 512 hidden neurons -> 1 output

Datageneration

  • .\smallbrain5.0.exe -gen
    • -threads <num>
    • -book <path/to/book>
    • -tb <path/to/tb>
    • -depth <depth>
    • -endgame <onlyGenEndgames>
  • Example: .\smallbrain5.0.exe -gen -threads 4 -book E:\Github\Smallbrain\src\data\DFRC_openings.epd -tb E:/Chess/345