diff options
| author | Adam <adammegarules1@gmail.com> | 2026-07-29 12:05:34 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-07-29 12:05:34 +0200 |
| commit | caeba26d600381b3fe0036b215cd4e4d5f956f79 (patch) | |
| tree | 567198d4263c9599bc2471f870243dbe73b45d00 /src/bot.cpp | |
| parent | b05b0862b9ad4f4c2ebc15b3ce23b2bcf0b21378 (diff) | |
fixing cache bug
Diffstat (limited to 'src/bot.cpp')
| -rw-r--r-- | src/bot.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bot.cpp b/src/bot.cpp index ff7a771..0f8d12a 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -172,6 +172,8 @@ float minimax(int depth, Game *b, float alpha, float beta) { return EvaluateBoardForWhite(b, depth); } + bool shouldStore = true; + float bestEval = b->turn ? -INFINITY : INFINITY; if (b->turn) { for (Move move : moves) { @@ -185,6 +187,7 @@ float minimax(int depth, Game *b, float alpha, float beta) { alpha = std::max(alpha, bestEval); if (alpha >= beta) { + shouldStore = false; break; // *snips* } } @@ -199,12 +202,15 @@ float minimax(int depth, Game *b, float alpha, float beta) { beta = std::min(beta, bestEval); if (alpha >= beta) { + shouldStore = false; break; // *snips* } } } - b->Transpositions->operator[](gameHash) = {depth, bestEval}; + if (shouldStore) { + b->Transpositions->operator[](gameHash) = {depth, bestEval}; + } return bestEval; } int PSTIndex(int square, bool white) { return white ? square : (56 ^ square); } |
