diff --git a/src/search.cpp b/src/search.cpp index c27d93d2565..16e84400dcd 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -848,7 +848,7 @@ Value Search::Worker::search( // If we have a good enough capture (or queen promotion) and a reduced search // returns a value much above beta, we can (almost) safely prune the previous move. probCutBeta = beta + 174 - 56 * improving; - if (depth > 3 + if (depth >= 3 && !is_decisive(beta) // If value from transposition table is lower than probCutBeta, don't attempt // probCut there and in further interactions with transposition table cutoff @@ -859,6 +859,7 @@ Value Search::Worker::search( assert(probCutBeta < VALUE_INFINITE && probCutBeta > beta); MovePicker mp(pos, ttData.move, probCutBeta - ss->staticEval, &thisThread->captureHistory); + Depth probCutDepth = std::max(depth - 4, 0); while ((move = mp.next_move()) != Move::none()) { @@ -888,9 +889,9 @@ Value Search::Worker::search( value = -qsearch(pos, ss + 1, -probCutBeta, -probCutBeta + 1); // If the qsearch held, perform the regular search - if (value >= probCutBeta) + if (value >= probCutBeta && probCutDepth > 0) value = - -search(pos, ss + 1, -probCutBeta, -probCutBeta + 1, depth - 4, !cutNode); + -search(pos, ss + 1, -probCutBeta, -probCutBeta + 1, probCutDepth, !cutNode); pos.undo_move(move); @@ -898,7 +899,7 @@ Value Search::Worker::search( { // Save ProbCut data into transposition table ttWriter.write(posKey, value_to_tt(value, ss->ply), ss->ttPv, BOUND_LOWER, - depth - 3, move, unadjustedStaticEval, tt.generation()); + probCutDepth + 1, move, unadjustedStaticEval, tt.generation()); if (!is_decisive(value)) return value - (probCutBeta - beta);