From: Lucas Braesch Date: Wed, 4 Sep 2013 23:26:05 +0000 (+0800) Subject: Do not prune useless checks in QS X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=10b53e1c5e6aeba156eb5c02afccfd7db1f84d16 Do not prune useless checks in QS Passed both SPRT tests in "simplification mode", so with elo0: -3.00 alpha: 0.05 elo1: 3.00 beta: 0.05 Short TC: LLR: 2.96 (-2.94,2.94) Total: 6243 W: 1302 L: 1195 D: 3746 Long TC LLR: 2.96 (-2.94,2.94) Total: 22972 W: 4124 L: 4020 D: 14828 bench: 4633330 --- diff --git a/src/search.cpp b/src/search.cpp index ee2d43b8..c9f1aee0 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -99,7 +99,6 @@ namespace { void id_loop(Position& pos); Value value_to_tt(Value v, int ply); Value value_from_tt(Value v, int ply); - bool check_is_dangerous(const Position& pos, Move move, Value futilityBase, Value beta); bool allows(const Position& pos, Move first, Move second); bool refutes(const Position& pos, Move first, Move second); string uci_pv(const Position& pos, int depth, Value alpha, Value beta); @@ -1267,16 +1266,6 @@ moves_loop: // When in check and at SpNode search starts from here && pos.see_sign(move) < 0) continue; - // Don't search useless checks - if ( !PvNode - && !InCheck - && givesCheck - && move != ttMove - && !pos.is_capture_or_promotion(move) - && ss->staticEval + PawnValueMg / 4 < beta - && !check_is_dangerous(pos, move, futilityBase, beta)) - continue; - // Check for legality only before to do the move if (!pos.pl_move_is_legal(move, ci.pinned)) continue; @@ -1354,42 +1343,6 @@ moves_loop: // When in check and at SpNode search starts from here } - // check_is_dangerous() tests if a checking move can be pruned in qsearch() - - bool check_is_dangerous(const Position& pos, Move move, Value futilityBase, Value beta) - { - Piece pc = pos.piece_moved(move); - Square from = from_sq(move); - Square to = to_sq(move); - Color them = ~pos.side_to_move(); - Square ksq = pos.king_square(them); - Bitboard enemies = pos.pieces(them); - Bitboard kingAtt = pos.attacks_from(ksq); - Bitboard occ = pos.pieces() ^ from ^ ksq; - Bitboard oldAtt = pos.attacks_from(pc, from, occ); - Bitboard newAtt = pos.attacks_from(pc, to, occ); - - // Checks which give opponent's king at most one escape square are dangerous - if (!more_than_one(kingAtt & ~(enemies | newAtt | to))) - return true; - - // Queen contact check is very dangerous - if (type_of(pc) == QUEEN && (kingAtt & to)) - return true; - - // Creating new double threats with checks is dangerous - Bitboard b = (enemies ^ ksq) & newAtt & ~oldAtt; - while (b) - { - // Note that here we generate illegal "double move"! - if (futilityBase + PieceValue[EG][pos.piece_on(pop_lsb(&b))] >= beta) - return true; - } - - return false; - } - - // allows() tests whether the 'first' move at previous ply somehow makes the // 'second' move possible, for instance if the moving piece is the same in // both moves. Normally the second move is the threat (the best move returned