+ // Step 17. Late moves reduction / extension (LMR, ~117 Elo)
+ // We use various heuristics for the sons of a node after the first son has
+ // been searched. In general we would like to reduce them, but there are many
+ // cases where we extend a son if it has good chances to be "interesting".
+ if ( depth >= 2
+ && moveCount > 1 + (PvNode && ss->ply <= 1)
+ && ( !ss->ttPv
+ || !capture
+ || (cutNode && (ss-1)->moveCount > 1)))
+ {
+ // In general we want to cap the LMR depth search at newDepth, but when
+ // reduction is negative, we allow this move a limited search extension
+ // beyond the first move depth. This may lead to hidden double extensions.
+ Depth d = std::clamp(newDepth - r, 1, newDepth + 1);