Skip to content

Latest commit

 

History

History
128 lines (101 loc) · 6.75 KB

readme.MD

File metadata and controls

128 lines (101 loc) · 6.75 KB

logo

Carp

Build License Release Commits

lichess-badge

Carp is a UCI-compatible didactic engine written in Rust, using a bitboard-based piece-centric approach.
The engine is built on top of a conventional Negamax search and uses a simple NNUE evaluation.

The main goal of this project is to learn the basics of both Rust and Chess Programming.

Rating Lists

Version CCRL 40/15 CCRL BLITZ CEGT 40/4 MCERL IPMAN
3.0.1 3406 3509 3430 N/a 3301
2.0.0 3087 3159 2980 3117 N/a
1.3.0 N/a N/a N/a 2675 N/a
1.2.0 N/a N/a N/a 2488 N/a
1.1.0 N/a N/a N/a 2164 N/a

Carp is rigorously tested with SPRT, and is part of the SWEHosting OB instance.

Project Structure & Building Carp

The project is structured in 3 main Cargo Workspaces: Chess is the game backend used by the engine, Engine is the UCI engine and Tools is an executable with developer tools. The first two crates are designed to be dependency-less, although Syzygy Tablebase support requires interfacing with Fathom (not compiled by default).

Building Carp only requires Cargo. Carp is currently tested on Rust Stable v1.70, so that is the recommended version, although it could possibly work (without guarantees) on earlier releases.

For development, Carp should be built through Cargo with cargo run --release --package engine.

To compile Carp for maximum performance, the use of PGO is highly recommended. Depending on the CPU, it has shown to be up to 60 elo over a standard Cargo build. To do this, either run make native to only build an executable targeting the machine's specific architecture, or build all available microarchitecture levels for the running OS through make release.

NOTE: the PGO build requires having llvm-profdata, which should be included with LLVM or CLANG.

NNUE

Carp uses a (768->1024)x2->1 perspective net trained with Bullet. It fully relies on its own self-play data for training the network. Data can be generated with the utilities provided in the Tools module. To build for datagen, simply run make datagen which also performs PGO.

As of Carp 2.0, NNUE has compltely replaced the old HCE.

Implemented optimizations

  • Fully legal move generation (~435 MNodes/s on a 7950x) with Fixed Shift Black Magic Bitboards
  • Fail-Hard Negamax + Quiescence
  • Iterative Deepening with Aspiration Windows
  • Move Ordering with a staged sorter:
    • MVV + Capture History with Threshold Static Exchange Evaluation
    • Quiet History
    • Continuation Histories
  • Multithreading with Lazy-SMP
  • Lockless Transposition table with aging
  • Principal Variation Search
  • Internal Iterative Reductions
  • Late Move Reductions
  • Null Move Pruning
  • Reverse Futility Pruning
  • Mate Distance Pruning
  • History Leaf Pruning
  • Extended Futility Pruning
  • Late Move Pruning
  • Singular Extensions
  • Syzygy Endgame Tablebases

Dependencies

None of these are strictly necessary to run the engine, but they are vital for development:

Credits