diff options
| author | Adam <adammegarules1@gmail.com> | 2026-08-19 21:19:32 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-08-19 21:19:32 +0200 |
| commit | d10a05eb92423777c6ff32edd14a1bea32214801 (patch) | |
| tree | c5b6868b7b2c8444dc42898bd569a0f7f3778726 /src/bot.cpp | |
| parent | 692029dd4614fd4b5f99538be0b46153eb8a19bc (diff) | |
perf(board): making hashing use incremental XORs instead of rebuild from scratch
Diffstat (limited to 'src/bot.cpp')
| -rw-r--r-- | src/bot.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
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; |
