From d10a05eb92423777c6ff32edd14a1bea32214801 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 19 Aug 2026 21:19:32 +0200 Subject: perf(board): making hashing use incremental XORs instead of rebuild from scratch --- src/bot.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/bot.cpp') diff --git a/src/bot.cpp b/src/bot.cpp index e9b0b4d..969606e 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -171,14 +171,12 @@ static int search(int depth, Game *b, int alpha, int beta, int ply) { return 0; } } - const uint64_t gameHash = GenerateZobristKey(b); - - if (isRepetionDraw(gameHash, b)) { + if (isRepetionDraw(b->hash, b)) { return 0; }; TranspositionsEntry *entry = nullptr; - if (auto it = b->Transpositions->find(gameHash); + if (auto it = b->Transpositions->find(b->hash); it != b->Transpositions->end()) { entry = &it->second; if (entry->depth >= depth) { @@ -241,7 +239,7 @@ static int search(int depth, Game *b, int alpha, int beta, int ply) { flag = UPPERBOUND; } - (*b->Transpositions)[gameHash] = { + (*b->Transpositions)[b->hash] = { .depth = depth, .Eval = bestScore, .flag = flag, .bestMove = bestMove}; } return bestScore; -- cgit v1.2.3