- givesCheck = gives_check(pos, move);
-
- // Step 13. Extensions (~70 Elo)
-
- // Singular extension search (~60 Elo). If all moves but one fail low on a
- // search of (alpha-s, beta-s), and just one fails high on (alpha, beta),
- // then that move is singular and should be extended. To verify this we do
- // a reduced search on all the other moves but the ttMove and if the
- // result is lower than ttValue minus a margin then we will extend the ttMove.
- if ( depth >= 8 * ONE_PLY
- && move == ttMove
- && !rootNode
- && !excludedMove // Avoid recursive singular search
- /* && ttValue != VALUE_NONE Already implicit in the next condition */
- && abs(ttValue) < VALUE_KNOWN_WIN
- && (tte->bound() & BOUND_LOWER)
- && tte->depth() >= depth - 3 * ONE_PLY
- && pos.legal(move))
- {
- Value singularBeta = ttValue - 2 * depth / ONE_PLY;
- ss->excludedMove = move;
- value = search<NonPV>(pos, ss, singularBeta - 1, singularBeta, depth / 2, cutNode);
- ss->excludedMove = MOVE_NONE;
-
- if (value < singularBeta)
- extension = ONE_PLY;
-
- // Multi-cut pruning
- // Our ttMove is assumed to fail high, and now we failed high also on a reduced
- // search without the ttMove. So we assume this expected Cut-node is not singular,
- // that is multiple moves fail high, and we can prune the whole subtree by returning
- // the hard beta bound.
- else if (cutNode && singularBeta > beta)
- return beta;
- }
-
- // Check extension (~2 Elo)
- else if ( givesCheck
- && (pos.blockers_for_king(~us) & from_sq(move) || pos.see_ge(move)))
- extension = ONE_PLY;
-
- // Castling extension
- else if (type_of(move) == CASTLING)
- extension = ONE_PLY;