verify: add the verify command to VERIFY builds (checks a and b)

(a) Along random games from standard and Chess960 positions (50 games of
up to 300 plies from each of 7 FENs), the incremental key and the position
check equal those of the same position set up from its FEN.

(b) After a 30000-playout search on four positions (standard, middlegame,
pawn endgame, Chess960): three forced collections down to 1/2, 1/4 and 1/8
of the tree, each compared with a snapshot taken by move path (visits, q,
u, base, state, key, check, and every edge). Survivors must be unchanged,
pruned nodes must keep visits and q with u = q and base = visits, both
arenas must end within their targets, and no pruned node may have more
visits than a kept one. Then a reroot two plies down the best line must
keep that subtree exactly. verify_tree runs after each step.

Only compiled with -DRIGBY_VERIFY_TREE. Bench: 663779

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rektdieandclaude committed 2026-11-16 19:37:17 +01:00
1 parent 6629525938
commit 226106e50a
3 files changed
+205

No files matched your search

+6
View File
@@ -225,6 +225,12 @@ public:
SearchResult search(const Position& root, const std::vector<u64>& history, const SearchLimits& limits,
bool print_info);
#ifdef RIGBY_VERIFY_TREE
// The `verify` command: incremental keys along random games, and garbage
// collection and rerooting against a snapshot of the tree. Aborts on a failure.
void self_test();
#endif
private:
using Clock = std::chrono::steady_clock;