Skip to content

Commit 10b53e1

Browse files
lucasartmcostalba
authored andcommitted
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
1 parent a30d357 commit 10b53e1

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

src/search.cpp

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ namespace {
9999
void id_loop(Position& pos);
100100
Value value_to_tt(Value v, int ply);
101101
Value value_from_tt(Value v, int ply);
102-
bool check_is_dangerous(const Position& pos, Move move, Value futilityBase, Value beta);
103102
bool allows(const Position& pos, Move first, Move second);
104103
bool refutes(const Position& pos, Move first, Move second);
105104
string uci_pv(const Position& pos, int depth, Value alpha, Value beta);
@@ -1267,16 +1266,6 @@ namespace {
12671266
&& pos.see_sign(move) < 0)
12681267
continue;
12691268

1270-
// Don't search useless checks
1271-
if ( !PvNode
1272-
&& !InCheck
1273-
&& givesCheck
1274-
&& move != ttMove
1275-
&& !pos.is_capture_or_promotion(move)
1276-
&& ss->staticEval + PawnValueMg / 4 < beta
1277-
&& !check_is_dangerous(pos, move, futilityBase, beta))
1278-
continue;
1279-
12801269
// Check for legality only before to do the move
12811270
if (!pos.pl_move_is_legal(move, ci.pinned))
12821271
continue;
@@ -1354,42 +1343,6 @@ namespace {
13541343
}
13551344

13561345

1357-
// check_is_dangerous() tests if a checking move can be pruned in qsearch()
1358-
1359-
bool check_is_dangerous(const Position& pos, Move move, Value futilityBase, Value beta)
1360-
{
1361-
Piece pc = pos.piece_moved(move);
1362-
Square from = from_sq(move);
1363-
Square to = to_sq(move);
1364-
Color them = ~pos.side_to_move();
1365-
Square ksq = pos.king_square(them);
1366-
Bitboard enemies = pos.pieces(them);
1367-
Bitboard kingAtt = pos.attacks_from<KING>(ksq);
1368-
Bitboard occ = pos.pieces() ^ from ^ ksq;
1369-
Bitboard oldAtt = pos.attacks_from(pc, from, occ);
1370-
Bitboard newAtt = pos.attacks_from(pc, to, occ);
1371-
1372-
// Checks which give opponent's king at most one escape square are dangerous
1373-
if (!more_than_one(kingAtt & ~(enemies | newAtt | to)))
1374-
return true;
1375-
1376-
// Queen contact check is very dangerous
1377-
if (type_of(pc) == QUEEN && (kingAtt & to))
1378-
return true;
1379-
1380-
// Creating new double threats with checks is dangerous
1381-
Bitboard b = (enemies ^ ksq) & newAtt & ~oldAtt;
1382-
while (b)
1383-
{
1384-
// Note that here we generate illegal "double move"!
1385-
if (futilityBase + PieceValue[EG][pos.piece_on(pop_lsb(&b))] >= beta)
1386-
return true;
1387-
}
1388-
1389-
return false;
1390-
}
1391-
1392-
13931346
// allows() tests whether the 'first' move at previous ply somehow makes the
13941347
// 'second' move possible, for instance if the moving piece is the same in
13951348
// both moves. Normally the second move is the threat (the best move returned

0 commit comments

Comments
 (0)