Skip to content

Commit 7b9b793

Browse files
pb00068vondele
authored andcommitted
Simplification of SEE verification logic
Use same logic for all handled pieces. Don't prune the move if opponent King, Queen, Rook gets a discovered attack while or after the exchanges. remove an obsolete comment in position.cpp Passed STC non regression: https://tests.stockfishchess.org/tests/view/6437907594daa91835c290d0 LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 107432 W: 28359 L: 28221 D: 50852 Ptnml(0-2): 298, 11724, 29524, 11882, 288 Passed LTC non-regression: https://tests.stockfishchess.org/tests/view/6438ed2ebd1a5470263c51e8 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 236288 W: 63656 L: 63656 D: 108976 Ptnml(0-2): 99, 22960, 72011, 22990, 84 closes #4533 bench: 3741125
1 parent c90dd38 commit 7b9b793

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/position.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ void Position::set_check_info() const {
331331

332332
/// Position::set_state() computes the hash keys of the position, and other
333333
/// data that once computed is updated incrementally as moves are made.
334-
/// The function is only used when a new position is set up, and to verify
335-
/// the correctness of the StateInfo data when running in debug mode.
334+
/// The function is only used when a new position is set up
336335

337336
void Position::set_state() const {
338337

src/search.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,17 +1006,15 @@ namespace {
10061006
{
10071007
if (depth < 2 - capture)
10081008
continue;
1009-
// Don't prune the move if opp. King/Queen/Rook is attacked by a slider after the exchanges.
1010-
// Since in see_ge we don't update occupied when the king recaptures, we also don't prune the
1011-
// move when the opp. King gets a discovered slider attack DURING the exchanges.
1012-
Bitboard leftEnemies = pos.pieces(~us, ROOK, QUEEN, KING) & occupied;
1009+
// Don't prune the move if opp. King/Queen/Rook gets a discovered attack during or after the exchanges
1010+
Bitboard leftEnemies = pos.pieces(~us, KING, QUEEN, ROOK);
10131011
Bitboard attacks = 0;
10141012
occupied |= to_sq(move);
10151013
while (leftEnemies && !attacks)
10161014
{
10171015
Square sq = pop_lsb(leftEnemies);
10181016
attacks = pos.attackers_to(sq, occupied) & pos.pieces(us) & occupied;
1019-
// Exclude Queen/Rook(s) which were already threatened before SEE
1017+
// Exclude Queen/Rook(s) which were already threatened before SEE (opp King can't be in check when it's our turn)
10201018
if (attacks && sq != pos.square<KING>(~us) && (pos.attackers_to(sq, pos.pieces()) & pos.pieces(us)))
10211019
attacks = 0;
10221020
}

0 commit comments

Comments
 (0)