Add transposition table, iterative deepening, and repetition-aware search

- Refactor the search to negamax (single side-relative score + alpha/beta window)
- Add a shared, process-wide transposition table: lock-free XOR-verified slots,
  persists across games, with depth-gated and difficulty-capped score reuse so a
  weak bot can't borrow a stronger game's deeper analysis
- Drive the search with iterative deepening, seeding each depth's move ordering
  from the previous one
- Seed prior-position history (Position::seed_history) over a new engine_best_move
  history parameter so the engine detects threefold/50-move draws the FEN can't carry

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
Josh-Heaps
2026-06-08 18:58:59 -06:00
co-authored by Claude Opus 4.8
parent 76b054ee9d
commit 5345427e0c
4 changed files with 239 additions and 54 deletions
+5
View File
@@ -47,6 +47,11 @@ public:
void do_move(Move m);
void undo_move(Move m);
// Seed prior-position keys (oldest first, excluding the current position) so
// is_draw() can see game history the FEN doesn't carry. Call once, right after
// from_fen and before any do_move.
void seed_history(const uint64_t* priorKeys, int count);
// --- freebies ---
uint64_t key() const { return zkey; }
bool is_draw() const; // 50-move + threefold + insufficient material