Skip to content

Teccii/cherry

Repository files navigation

Cherry

License Release Commits

Rust LGBTQ+ Friendly Trans Rights

Cherry is a superhuman UCI chess engine. It supports both Standard and (Double) Fischer Random chess, and is exclusively trained on self-generated training data.

Board Representation and Move Generation

Internally, Cherry uses a mailbox representation. It uses incrementally updated attack tables for move generation. Vector math is used to achieve similar speeds to traditional bitboard engines, which is also the reason why Cherry is much faster on AVX-512 machines than on AVX-2 machines.

These attack tables are useful for certain heuristics, such as threat-bucketed history tables, Static Exchange Evaluation, and in the future, NNUE threat inputs. All credit goes to 87flowers for coming up with the techniques to vectorize these operations and for writing an amazing blog series about it.

Search

  • Iterative Deepening
  • Aspiration Windows
  • Principal Variation Search (PVS)
  • Quiescence Search (QS)
  • Transposition Table
  • Reverse Futility Pruning (RFP)
  • Null Move Pruning (NMP)
    • Verification Search
  • Move Loop Pruning
    • SEE Pruning
    • Late Move Pruning (LMP)
    • Futility Pruning (FP)
    • History Pruning
  • Singular Extensions (SE)
    • Double Extensions
    • Negative Extensions
    • Multi-Cut
  • Late Move Reductions (LMR)
  • Syzygy Endgame Tablebases

Move Ordering

  • Hash Move
  • Quiet History
  • Tactic History
  • Pawn History
  • Continuation History (1 and 2 plies)
  • Static Exchange Evaluation (SEE)

Static Evaluation

  • NNUE (768hm->1024)x2->1x8
    • Dual Perspective
    • Horizontal Mirroring
    • Eight Output Buckets
    • Self-generated training data (8 random moves, 5000 soft nodes per move)
    • Trained with bullet on 930 million positions
  • Correction History
    • Pawn Structure
    • Minor Pieces
    • Major Pieces
    • White Non-Pawns
    • Black Non-Pawns
    • Continuation Correction (1 and 2 plies)
  • Material Scaling

Time Management

  • Move Stability
  • Score Stability
  • Subtree Ratio

UCI Options

Name Type Default Valid Values Description
Threads Integer 1 1..=2048 Number of Search Threads
Hash Integer 16 1..=67108864 Memory Allocated to the Transposition Table (in MiB)
MultiPV Integer 1 1..=218 Number of Variations to Display
Minimal Boolean false true or false When enabled, Cherry outputs only the final info line and best move
EvalScaling Boolean true true or false When enabled, Cherry's evaluation function is scaled according to internal heuristics
SyzygyPath String <empty> Any Path File path of Syzygy Tablebases (Can only be configured once during the runtime of the program)
MoveOverhead Integer 100 0..=5000 Time in milliseconds used to compensate for the delay between engine and interface communication
SoftTarget Boolean false true or false When enabled, go nodes <n> and go movetime <ms> will only stop after a completed depth
Ponder Boolean false true or false When enabled, Cherry will think on the opponent's time
UCI_Chess960 Boolean false true or false Whether to output UCI moves using standard notation (e1g1/e1c1) or Chess960 notation (e.g. e1h1, e1a1)

Building

Cherry requires Make and any version of Rust. The required toolchain and version will be automatically installed.

> make EXE=<NAME>
  • Replace <NAME> with the desired name for the binary. The default name is Cherry.
  • EVALFILE=<FILE> can also be passed in to build a binary with a specific neural network embedded, though the code must be changed to reflect this network's architecture.

Since neural networks are extremely large files, Cherry's neural networks are stored in a separate repository to avoid bloating this repository's size. Because of this, you need to run make at least once before you can use cargo to build and run Cherry.

Credit

These engines have been notable sources of ideas or inspiration:

Cherry is tested on MattBench, which is an OpenBench instance maintained by Nocturn9x.

Additionally, these individuals have made developing Cherry easier and a more enjoyable experience:

About

UCI compliant chess engine written in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages