aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-07-29 12:05:34 +0200
committerAdam <adammegarules1@gmail.com>2026-07-29 12:05:34 +0200
commitcaeba26d600381b3fe0036b215cd4e4d5f956f79 (patch)
tree567198d4263c9599bc2471f870243dbe73b45d00 /src
parentb05b0862b9ad4f4c2ebc15b3ce23b2bcf0b21378 (diff)
fixing cache bug
Diffstat (limited to 'src')
-rw-r--r--src/bot.cpp8
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); }