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:
co-authored by
Claude Opus 4.8
parent
76b054ee9d
commit
5345427e0c
@@ -316,6 +316,18 @@ bool Position::insufficient_material() const {
|
||||
return minors <= 1; // KvK, KvKN, KvKB
|
||||
}
|
||||
|
||||
void Position::seed_history(const uint64_t* priorKeys, int count) {
|
||||
if (count <= 0) return;
|
||||
if (count > 1000) count = 1000; // leave headroom in repKeys for search plies
|
||||
|
||||
uint64_t current = zkey; // from_fen placed this at repKeys[0]
|
||||
for (int i = 0; i < count; ++i)
|
||||
repKeys[i] = priorKeys[i];
|
||||
repKeys[count] = current;
|
||||
repCount = count + 1;
|
||||
rule50 = count; // == half-moves since the last irreversible move
|
||||
}
|
||||
|
||||
bool Position::is_draw() const {
|
||||
if (rule50 >= 100) return true;
|
||||
if (insufficient_material()) return true;
|
||||
|
||||
Reference in New Issue
Block a user