]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Adjust return value in qsearch after fail high
[stockfish] / src / search.cpp
index bd3da5a23b1bd0662488beaa807d0e093688e146..fad43b624dc86009fa8980d24981a6bb9c25c5e0 100644 (file)
@@ -1618,6 +1618,9 @@ Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {
         return mated_in(ss->ply);  // Plies to mate from the root
     }
 
+    if (abs(bestValue) < VALUE_TB_WIN_IN_MAX_PLY)
+        bestValue = bestValue >= beta ? (3 * bestValue + beta) / 4 : bestValue;
+
     // Save gathered info in transposition table
     tte->save(posKey, value_to_tt(bestValue, ss->ply), pvHit,
               bestValue >= beta ? BOUND_LOWER : BOUND_UPPER, ttDepth, bestMove, ss->staticEval);