}
double bestMoveInstability = 1 + totBestMoveChanges / Threads.size();
- // Stop the search if we have only one legal move, or if available time elapsed
- if ( rootMoves.size() == 1
- || Time.elapsed() > Time.optimum() * fallingEval * reduction * bestMoveInstability)
+ double totalTime = rootMoves.size() == 1 ? 0 :
+ Time.optimum() * fallingEval * reduction * bestMoveInstability;
+
+ // Stop the search if we have exceeded the totalTime, at least 1ms search.
+ if (Time.elapsed() > totalTime)
{
// If we are allowed to ponder do not stop the search now but
// keep pondering until the GUI sends "ponderhit" or "stop".
}
else if ( Threads.increaseDepth
&& !mainThread->ponder
- && Time.elapsed() > Time.optimum() * fallingEval * reduction * bestMoveInstability * 0.6)
+ && Time.elapsed() > totalTime * 0.6)
Threads.increaseDepth = false;
else
Threads.increaseDepth = true;
Depth extension, newDepth;
Value bestValue, value, ttValue, eval, maxValue;
bool ttHit, ttPv, formerPv, givesCheck, improving, didLMR, priorCapture;
- bool captureOrPromotion, doFullDepthSearch, moveCountPruning, ttCapture, singularLMR;
+ bool captureOrPromotion, doFullDepthSearch, moveCountPruning,
+ ttCapture, singularQuietLMR;
Piece movedPiece;
int moveCount, captureCount, quietCount;
contHist,
countermove,
ss->killers,
- depth > 12 ? ss->ply : MAX_PLY);
+ ss->ply);
value = bestValue;
- singularLMR = moveCountPruning = false;
+ singularQuietLMR = moveCountPruning = false;
ttCapture = ttMove && pos.capture_or_promotion(ttMove);
// Mark this node as being searched
if (value < singularBeta)
{
extension = 1;
- singularLMR = true;
+ singularQuietLMR = !ttCapture;
}
// Multi-cut pruning
r--;
// Decrease reduction if ttMove has been singularly extended (~3 Elo)
- if (singularLMR)
+ if (singularQuietLMR)
r -= 1 + formerPv;
if (!captureOrPromotion)