UCI chess engine with NNUE evaluation
Prelude is a UCI-compatible chess engine utilizing advanced search* algorithms and a neural network (NNUE) for evaluation. Designed for high performance** and configurability, Prelude is not ideal for chess enthusiasts and developers.
*depends on a person's definition of advanced
**performance is unlikely
- Functional UCI implementation with custom commands:
d
: Display the current board position.move <move>
: Applies a move in long algebraic notation.bulk <depth>
: Starts a perft test from the current position using bulk counting.perft <depth>
: Performs a perft test from the current position.perftsuite <suite>
: Executes a suite of perft tests*.bench <depth>
: Benchmarks engine performance on test positions.position kiwipete
: Loads the "Kiwipete" position, commonly used for debugging.debug.gamestate
: Displays the current board state and game metadata.debug.moves
: Lists all moves** for the current position.debug.eval
: Outputs the evaluation of the current position.debug.popcnt
: Displays piece counts for both sides.
*Uses bulk counting
**All pseudolegal moves
- Bitboard implementation.
- Incremental zobrist hashing for fast position recognition.
- Efficient NNUE updates.
- Fail-soft Principal Variation Search (PVS) with alpha-beta pruning.
- Transposition Table (TT) used for move ordering and cutoffs.
- Null move pruning, reverse futility pruning, with more to come.
- Iterative deepening with aspiration windows.
- Quiescence search.
- NNUE evaluation
- Currently uses perspective network trained on bullet
- TT best move prioritization.
- Most valuable victim - least valuable attacker (MVVLVA) prioritization for captures.
- Make: Uses make to build the executable.
- Clang++ Compiler: Requires support for C++20 or later.
- CPU Architecture: Requires support for AVX2 or later.
- Neural Network File: Provide an NNUE and update the code to load it (included nnue.bin is recommended).
-
Clone the repository:
git clone https://github.com/Quinniboi10/Prelude.git cd Prelude
-
Compile using make:
make
-
Run the engine:
./Prelude
Prelude uses the UCI protocol but supports custom debugging and testing commands. Compatible with GUIs like Cute Chess, En Croissant, or any UCI-compatible interface. See above commands.
Prelude supports customizable options via the setoption
command:
Threads
: Number of threads to use (1 to 1024). Default: 1.Hash
: Configurable hash table size (1 to 4096 MB). Default: 16 MB.Move Overhead
: Adjusts time overhead per move (0 to 1000 ms). Default: 20 ms.
Ensure a NNUE file is correctly placed. Update its path in the code if necessary:
#define EVALFILE "./pathToYourNNUE.bin"
- Vast: Help hunting for bugs and explaining concepts
- Ciekce: Lots of guidance and test NNUEs
- Shawn_xu: Explaining NNUEs and many other things
- A_randomnoob: Fixing obvious mistakes
- Matt: Providing help and allowing me to use his git instance
- jw: Helping me with NNUE training
Prelude is released under the GNU 3 License. See LICENSE
for details.