+ // Step 13. Pruning at shallow depth (~200 Elo)
+ if ( !rootNode
+ && pos.non_pawn_material(us)
+ && bestValue > VALUE_TB_LOSS_IN_MAX_PLY)
+ {
+ // Skip quiet moves if movecount exceeds our FutilityMoveCount threshold
+ moveCountPruning = moveCount >= futility_move_count(improving, depth);
+
+ // Reduced depth of the next LMR search
+ int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount), 0);
+
+ if ( captureOrPromotion
+ || givesCheck)
+ {
+ // Capture history based pruning when the move doesn't give check
+ if ( !givesCheck
+ && lmrDepth < 1
+ && captureHistory[movedPiece][to_sq(move)][type_of(pos.piece_on(to_sq(move)))] < 0)
+ continue;
+
+ // SEE based pruning
+ if (!pos.see_ge(move, Value(-218) * depth)) // (~25 Elo)
+ continue;
+ }
+ else
+ {
+ // Countermoves based pruning (~20 Elo)
+ if ( lmrDepth < 4 + ((ss-1)->statScore > 0 || (ss-1)->moveCount == 1)
+ && (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold
+ && (*contHist[1])[movedPiece][to_sq(move)] < CounterMovePruneThreshold)
+ continue;
+
+ // Futility pruning: parent node (~5 Elo)
+ if ( lmrDepth < 7
+ && !ss->inCheck
+ && ss->staticEval + 174 + 157 * lmrDepth <= alpha
+ && (*contHist[0])[movedPiece][to_sq(move)]
+ + (*contHist[1])[movedPiece][to_sq(move)]
+ + (*contHist[3])[movedPiece][to_sq(move)]
+ + (*contHist[5])[movedPiece][to_sq(move)] / 3 < 28255)
+ continue;
+
+ // Prune moves with negative SEE (~20 Elo)
+ if (!pos.see_ge(move, Value(-(30 - std::min(lmrDepth, 18)) * lmrDepth * lmrDepth)))
+ continue;
+ }
+ }
+
+ // Step 14. Extensions (~75 Elo)
+
+ // Singular extension search (~70 Elo). If all moves but one fail low on a