diff options
| author | Adam <adammegarules1@gmail.com> | 2026-07-29 08:59:01 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-07-29 08:59:01 +0200 |
| commit | 9ec09d7151ea8fa78d082ab931691a5db2f1be6a (patch) | |
| tree | eb6beb6132160f8d7f82e295028a532998771eb9 /src/bot.cpp | |
| parent | 815abe7aabf47814dc391d19dedd6e9b23f100a1 (diff) | |
making cache have depth
Diffstat (limited to 'src/bot.cpp')
| -rw-r--r-- | src/bot.cpp | 8 |
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); } |
