- bool singleReply = (isCheck && mp.number_of_evasions() == 1);
- bool moveIsCheck = pos.move_is_check(move, dcCandidates);
- bool moveIsCapture = pos.move_is_capture(move);
+ if (move == excludedMove)
+ continue;
+
+ moveIsCheck = pos.move_is_check(move, ci);
+ singleEvasion = (isCheck && mp.number_of_evasions() == 1);
+ captureOrPromotion = pos.move_is_capture_or_promotion(move);
+
+ // Decide the new search depth
+ ext = extension(pos, move, false, captureOrPromotion, moveIsCheck, singleEvasion, mateThreat, &dangerous);
+
+ // Singular extension search. We extend the TT move if its value is much better than
+ // its siblings. To verify this we do a reduced search on all the other moves but the
+ // ttMove, if result is lower then ttValue minus a margin then we extend ttMove.
+ if ( depth >= 8 * OnePly
+ && tte
+ && move == tte->move()
+ && !excludedMove // Do not allow recursive single-reply search
+ && ext < OnePly
+ && is_lower_bound(tte->type())
+ && tte->depth() >= depth - 3 * OnePly)
+ {
+ Value ttValue = value_from_tt(tte->value(), ply);
+
+ if (abs(ttValue) < VALUE_KNOWN_WIN)
+ {
+ Value excValue = search(pos, ss, ttValue - SingleReplyMargin, depth / 2, ply, false, threadID, move);