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
+29
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "position.h"
|
||||
|
||||
namespace rigby::eval {
|
||||
|
||||
// Stand-in evaluation until the network arrives. Everything here is replaced by
|
||||
// the value and policy heads of the net trained on Lc0 data.
|
||||
|
||||
void init();
|
||||
|
||||
// Static evaluation in centipawns, from the side to move's view.
|
||||
int static_eval(const Position& pos);
|
||||
|
||||
// Capture-only search on top of the static evaluation, side to move's view.
|
||||
int quiescence(const Position& pos, int alpha, int beta, int ply);
|
||||
|
||||
// Expected score in [-1, 1] for the side to move.
|
||||
float value(const Position& pos);
|
||||
|
||||
// Writes softmax-normalised priors for `moves` into `out`.
|
||||
void policy(const Position& pos, const MoveList& moves, float temperature, float* out);
|
||||
|
||||
// Conversion between centipawns and Q in [-1, 1]. One scale for both directions,
|
||||
// so reported scores match what the search actually optimises.
|
||||
float cp_to_q(int cp);
|
||||
int q_to_cp(float q);
|
||||
|
||||
} // namespace rigby::eval
|
||||
Reference in new issue
Block a user