From caeba26d600381b3fe0036b215cd4e4d5f956f79 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 29 Jul 2026 12:05:34 +0200 Subject: fixing cache bug --- src/bot.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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); } -- cgit v1.2.3