Optimize evasions in Position::pseudo_legal()

STC: https://tests.stockfishchess.org/tests/view/6a4be17d5529b8472df7fa60
LLR: 3.68 (-2.94,2.94) <0.00,2.00>
Total: 405888 W: 105701 L: 104837 D: 195350
Ptnml(0-2): 872, 42472, 115373, 43374, 853

closes https://github.com/official-stockfish/Stockfish/pull/6968

No functional change
This commit is contained in:
mstembera
2026-07-16 08:28:21 +02:00
committed by Joost VandeVondele
parent 057e9bf4da
commit a255ad59e3
+10 -2
View File
@@ -745,8 +745,16 @@ bool Position::pseudo_legal(const Move m) const {
else if (!(attacks_bb(type_of(pc), from, pieces()) & to)) else if (!(attacks_bb(type_of(pc), from, pieces()) & to))
return false; return false;
if (checkers()) if (checkers() && type_of(pc) != KING)
return MoveList<EVASIONS>(*this).contains(m); {
// In double check, only a king move can evade
if (more_than_one(checkers()))
return false;
// The move must block the check or capture the checker
if (!(between_bb(square<KING>(us), lsb(checkers())) & to))
return false;
}
return true; return true;
} }