- // Step 16. Late moves reduction / extension (LMR, ~200 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 >= 3
- && moveCount > 1 + 2 * rootNode
- && ( !captureOrPromotion
- || (cutNode && (ss-1)->moveCount > 1)
- || !ss->ttPv)
- && (!PvNode || ss->ply > 1 || thisThread->id() % 4 != 3))
- {
- Depth r = reduction(improving, depth, moveCount, rangeReduction > 2);
-
- // Decrease reduction if on the PV (~2 Elo)
- if ( PvNode
- && bestMoveCount <= 3)
- r--;
-
- // Decrease reduction if position is or has been on the PV
- // and node is not likely to fail low. (~3 Elo)
- if ( ss->ttPv
- && !likelyFailLow)
- r -= 2;
-
- // Increase reduction at root and non-PV nodes when the best move does not change frequently
- if ( (rootNode || !PvNode)
- && thisThread->bestMoveChanges <= 2)
- r++;
-
- // Decrease reduction if opponent's move count is high (~1 Elo)
- if ((ss-1)->moveCount > 13)
- r--;
-
- // Decrease reduction if ttMove has been singularly extended (~1 Elo)
- if (singularQuietLMR)
- r--;
-
- // Increase reduction for cut nodes (~3 Elo)
- if (cutNode && move != ss->killers[0])
- r += 2;