1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

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 https://github.com/official-stockfish/Stockfish/pull/4533

bench: 3741125
This commit is contained in:
Guenther Demetz 2023-04-17 11:38:26 +02:00 committed by Joost VandeVondele
parent c90dd38903
commit 7b9b793fd5
2 changed files with 4 additions and 7 deletions

View file

@ -331,8 +331,7 @@ void Position::set_check_info() const {
/// Position::set_state() computes the hash keys of the position, and other
/// data that once computed is updated incrementally as moves are made.
/// The function is only used when a new position is set up, and to verify
/// the correctness of the StateInfo data when running in debug mode.
/// The function is only used when a new position is set up
void Position::set_state() const {

View file

@ -1006,17 +1006,15 @@ moves_loop: // When in check, search starts here
{
if (depth < 2 - capture)
continue;
// Don't prune the move if opp. King/Queen/Rook is attacked by a slider after the exchanges.
// Since in see_ge we don't update occupied when the king recaptures, we also don't prune the
// move when the opp. King gets a discovered slider attack DURING the exchanges.
Bitboard leftEnemies = pos.pieces(~us, ROOK, QUEEN, KING) & occupied;
// Don't prune the move if opp. King/Queen/Rook gets a discovered attack during or after the exchanges
Bitboard leftEnemies = pos.pieces(~us, KING, QUEEN, ROOK);
Bitboard attacks = 0;
occupied |= to_sq(move);
while (leftEnemies && !attacks)
{
Square sq = pop_lsb(leftEnemies);
attacks = pos.attackers_to(sq, occupied) & pos.pieces(us) & occupied;
// Exclude Queen/Rook(s) which were already threatened before SEE
// Exclude Queen/Rook(s) which were already threatened before SEE (opp King can't be in check when it's our turn)
if (attacks && sq != pos.square<KING>(~us) && (pos.attackers_to(sq, pos.pieces()) & pos.pieces(us)))
attacks = 0;
}