diff --git a/src/search.cpp b/src/search.cpp index 6d05d2c8a..b497552ae 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -583,8 +583,10 @@ bool Search::Worker::iterative_deepening() { auto elapsedTime = elapsed(); - // Stop the search if we have exceeded the totalTime or maximum - if (elapsedTime > std::min(totalTime, double(mainThread->tm.maximum()))) + // Stop the search if we have exceeded totalTime or maximum time, + // or if we know that there are no better moves in the analysed line(s) + if (elapsedTime > std::min(totalTime, double(mainThread->tm.maximum())) + || rootMoves[multiPV - 1].score >= mate_in(3) || rootMoves[0].score == mated_in(2)) { // If we are allowed to ponder do not stop the search now but // keep pondering until the GUI sends "ponderhit" or "stop".