]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Make static value saved in TT independent from ply
[stockfish] / src / search.cpp
index b4c08373444f8caf53c50d47ff6ac0edf04c1841..7bc90b143d10b85a94ff0a4cbf9f214e9d0b3525 100644 (file)
@@ -1540,10 +1540,10 @@ namespace {
         // Use the cached evaluation score if possible
         assert(ei.futilityMargin == Value(0));
 
-        staticValue = tte->value();
+        staticValue = tte->value() + ply;
     }
     else
-        staticValue = evaluate(pos, ei, threadID);
+        staticValue = evaluate(pos, ei, threadID) + ply;
 
     if (ply == PLY_MAX - 1)
         return evaluate(pos, ei, threadID);
@@ -1556,7 +1556,7 @@ namespace {
     {
         // Store the score to avoid a future costly evaluation() call
         if (!isCheck && !tte && ei.futilityMargin == 0)
-            TT.store(pos.get_key(), value_to_tt(bestValue, ply), VALUE_TYPE_EVAL, Depth(-127*OnePly), MOVE_NONE);
+            TT.store(pos.get_key(), bestValue - ply, VALUE_TYPE_EVAL, Depth(-127*OnePly), MOVE_NONE);
 
         return bestValue;
     }