Serendipity is a UCI chess engine written in the Java programming language. With a CCRL rating of more than 3500 elo, it is the strongest Java chess engine in the world.
In early January 2024, I was inspired by a tom7 video to create a chess arena in Java. It didn't get very far, however, as I soon focused all my development effort in a minimax implementation.
In March, I began to work on NNUE support. After completing NNUE, the strength of Serendipity skyrocketed, I had several commits with gains of over 100 Elo. On March 27, I published my first release. The results were much better than I had expected, as it turns out that I have vastly underestimated Serendipity's strength. Two days later, I made my first Stockfish commit.
In May, four other engine developers and I co-founded an OpenBench instance, where Serendipity testing happens to this day.
In August, I implemented multithreading for Serendipity's first debut Top Chess Engines Championship.
- January 9, 2024: First commit to arena project
- January 12, 2024: First main repo commit
- March 10, 2024: NNUE support
- March 27, 2024: First release of Serendipity
- May 24, 2024: OpenBench instance founded
- August 23, 2024: Multithreading support
- August 26, 2024: TCEC Debut
As of November 2024, Serendipity is the strongest Java engine in the world and around top 50 overall.
Version | CCRL Blitz | CCRL 40/15 |
---|---|---|
v0.1 | - | 3227 |
v0.2 | 3411 | - |
v0.3 | - | 3390 |
v0.4 | 3518 | 3446 |
To build Serendipity from source, install maven
, make
, git
and wget
. Then run the following:
git clone [email protected]:xu-shawn/Serendipity.git
cd Serendipity
make
This will produce two versions of Serendipity executable: Serendipity-Dev
and Serendipity.jar
.
Serendipity-Dev
is a standalone executable that can be run on Linux or MacOS directly.
Serendipity.jar
is cross platform, but it requires extra commands to run. See section below for more details.
Serendipity only supports Java version 17 or higher due to its dependency on Java's (incubating) Vector API. To run Serendipity.jar
:
java -jar --add-modules jdk.incubator.vector Serendipity.jar
Alternatively, if you are on Linux/MacOS, you can also opt to run the Serendipity executable file:
./Serendipity
- Efficiency
- Iterative Deepening
- Aspiration Windows
- Principle Variation Search (PVS)
- Transposition Table
- Shared Transposition Table
- 10-byte entries
- Parallel array implementation
- Multithreading
- Lazy SMP
- Move Ordering
- Butterfly History
- Capture History
- Continuation Histories
- 1-ply Continuation History
- 2-ply Continuation History
- 4-ply Continuation History
- 6-ply Continuation History
- Ordering of Captures by Static Exchange Evaluation (SEE)
- Selectivity
- Quiescent Search (QS)
- QS SEE Pruning
- QS Futility Pruning
- Extensions
- Singular Extensions
- 1-ply Extension of PV Nodes
- 2-ply Extension of Non-PV Nodes
- Singular Extensions
- Pruning
- Before Moves Loop
- Null Move Pruning
- Reverse Futility Pruning
- Razoring
- Moves Loop Prunings
- Futility Pruning
- PVS SEE Pruning
- Multi-cut Pruning
- Before Moves Loop
- Reductions
- Late Move Reductions
- Internal Iterative Reductions
- Quiescent Search (QS)
Serendipity relies on a side-relative and efficiently updatable neural network for evaluation. This allows the network to be efficently updated between moves, which helps the engine obtain good evaluation with reasonable speed.
The description of the network architecture, as well as the training procedure, is beyond the scope of this document.
Big shoutout to everyone who has contributed ideas or code to this project.
Serendipity depends on the following libraries:
chesslib
for move generation and board representationJUnit
for testing critical components of the engine
Serendipity's neural network is trained on open data generously provided by the Leela Chess Zero project.
Testing Serendipity requires thosands of hours of compute, so thanks to everyone on our OpenBench instance for their contributions, however big or small. The names of these people are listed below, by alphabetical order:
- ArjunBasandrai
- aronpetko
- gab8192
- Haxk20
- Jochengehtab
- noobpwnftw
- Styxdoto
- Vast342
- Witek902
- yl25946
- Yoshie2000
Thanks to engine testers such as CCRL and Silvian Rucsandescu for running and testing the engine.
Finally, thanks to everyone on the Stockfish Discord, Engine Programming Discord, and the unofficial CPW Discord for being kind, knowledgable, and collaborative.