feat: minimal MCTS engine with UCI
Bitboard board with fancy magics and fully legal move generation, checked by a perft suite. PUCT search over a node arena with FPU reduction and in-tree draw detection. Hand-written value (eval + quiescence) and heuristic policy stand in until the network is trained. UCI loop with a search thread, OpenBench-compatible bench and Makefile. Bench: 546127 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
d3044c0b88
19 files changed
+1997
No files matched your search
@@ -0,0 +1,64 @@
|
||||
# Rigby
|
||||
|
||||
Rigby is a UCI chess engine built on Monte Carlo Tree Search (PUCT). The goal is a
|
||||
neural-network-guided MCTS engine, later a Monte Carlo Graph Search (MCGS), with a
|
||||
value and policy network trained with [bullet](https://github.com/jw1912/bullet) on
|
||||
data generated by Leela Chess Zero, and CUDA inference.
|
||||
|
||||
Every change is validated with SPRT on OpenBench.
|
||||
|
||||
## Current state (0.1-dev)
|
||||
|
||||
- Bitboard board with fancy magic attacks, fully legal move generation, copy-make.
|
||||
Verified with a perft suite (`Rigby perftsuite`).
|
||||
- PUCT search: node arena with contiguous children, first-play urgency reduction,
|
||||
two-fold repetition, 50-move and insufficient-material draws inside the tree.
|
||||
- Placeholder evaluation until the network exists: a small hand-written
|
||||
evaluation behind a capture-only quiescence search for the value, and move
|
||||
heuristics (captures, promotions, checks, pawn threats) for the policy.
|
||||
- Single-threaded, no tree reuse between moves.
|
||||
|
||||
## Building
|
||||
|
||||
Needs `clang++` (C++20) and `make`. On Windows clang must have a MinGW runtime,
|
||||
the build targets `x86_64-w64-windows-gnu`, same as Eleanor.
|
||||
|
||||
```
|
||||
make
|
||||
make EXE=Rigby-dev
|
||||
```
|
||||
|
||||
## UCI
|
||||
|
||||
Standard commands: `uci`, `isready`, `ucinewgame`, `position`, `go`
|
||||
(`wtime btime winc binc movestogo movetime nodes depth infinite`), `stop`, `quit`,
|
||||
`setoption`.
|
||||
|
||||
Extra commands:
|
||||
|
||||
| Command | Meaning |
|
||||
| --- | --- |
|
||||
| `d` | Print the board, FEN and hash key |
|
||||
| `eval` | Static and quiescence evaluation of the current position |
|
||||
| `perft <depth>` | Perft with per-move breakdown |
|
||||
| `perftsuite [maxdepth]` | Standard perft positions with expected counts |
|
||||
| `bench [playouts]` | Fixed playout search over the bench positions |
|
||||
|
||||
`go depth N` limits the mean playout depth. `nodes` in `info` lines are playouts.
|
||||
|
||||
### Options
|
||||
|
||||
| Option | Default | Meaning |
|
||||
| --- | --- | --- |
|
||||
| Hash | 64 | Tree memory in MB. A node takes 20 bytes. |
|
||||
| Threads | 1 | Only 1 for now. |
|
||||
| MoveOverhead | 20 | Milliseconds kept back per move. |
|
||||
| CPuct | 160 | Exploration constant x100. |
|
||||
| FPUReduction | 30 | First-play urgency reduction x100. |
|
||||
| PolicyTemp | 100 | Policy softmax temperature x100. |
|
||||
|
||||
## Bench
|
||||
|
||||
`Rigby bench` runs 5000 playouts on each of 16 positions. The reported node count is
|
||||
the number of positions visited in the tree over all playouts, so it changes
|
||||
whenever search behaviour changes, while the playout count stays fixed.
|
||||
Reference in new issue
Block a user