- // Stop the search if only one legal move is available, or if all
- // of the available time has been used
- const int F[] = { mainThread->failedLow,
- bestValue - mainThread->previousScore };
- int improvingFactor = std::max(229, std::min(715, 357 + 119 * F[0] - 6 * F[1]));
-
- Color us = rootPos.side_to_move();
- bool thinkHard = bestValue == VALUE_DRAW
- && Limits.time[us] - Time.elapsed() > Limits.time[~us]
- && ::pv_is_draw(rootPos);
-
- double unstablePvFactor = 1 + mainThread->bestMoveChanges + thinkHard;
-
- // if the bestMove is stable over several iterations, reduce time for this move,
- // the longer the move has been stable, the more.
- // Use part of the gained time from a previous stable move for the current move.
- timeReduction = 1;
- for (int i : {3, 4, 5})
- if (lastBestMoveDepth * i < completedDepth && !thinkHard)
- timeReduction *= 1.3;
- unstablePvFactor *= std::pow(mainThread->previousTimeReduction, 0.51) / timeReduction;
-
- if ( rootMoves.size() == 1
- || Time.elapsed() > Time.optimum() * unstablePvFactor * improvingFactor / 628)
- {
- // If we are allowed to ponder do not stop the search now but
- // keep pondering until the GUI sends "ponderhit" or "stop".
- if (Threads.ponder)
- Threads.stopOnPonderhit = true;
- else
- Threads.stop = true;
- }
+ // If we are allowed to ponder do not stop the search now but
+ // keep pondering until the GUI sends "ponderhit" or "stop".
+ if (mainThread->ponder)
+ mainThread->stopOnPonderhit = true;
+ else
+ Threads.stop = true;