aboutsummaryrefslogtreecommitdiff
path: root/src/bot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bot.cpp')
-rw-r--r--src/bot.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bot.cpp b/src/bot.cpp
index 8a570e4..3394ae2 100644
--- a/src/bot.cpp
+++ b/src/bot.cpp
@@ -137,8 +137,10 @@ float minimax(int depth, Game *b, float alpha, float beta) {
uint64_t gameHash = GenerateZobristKey(b);
if (b->Transpositions->contains(gameHash)) {
- float value = b->Transpositions->at(gameHash);
- return value;
+ TranspositionsEntry data = b->Transpositions->at(gameHash);
+ if (data.depth >= depth) {
+ return data.Eval;
+ }
}
auto moves = GetLegalMoves(b);
if (moves.size() == 0) {
@@ -181,7 +183,7 @@ float minimax(int depth, Game *b, float alpha, float beta) {
}
}
- b->Transpositions->operator[](gameHash) = bestEval;
+ b->Transpositions->operator[](gameHash) = {depth, bestEval};
return bestEval;
}
int PSTIndex(int square, bool white) { return white ? square : (56 ^ square); }