mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-22 12:47:08 +00:00
Simplify attackers_to_exist function
test based on #6586 by maximmasiutin https://tests.stockfishchess.org/tests/view/69977d58e2562aa5bc1e09c4 LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 225056 W: 58208 L: 58195 D: 108653 Ptnml(0-2): 677, 25001, 61196, 24940, 714 closes https://github.com/official-stockfish/Stockfish/pull/6633 No functional change
This commit is contained in:
committed by
Joost VandeVondele
parent
4c0878cb0b
commit
702d4b8c9d
+4
-7
@@ -513,13 +513,10 @@ Bitboard Position::attackers_to(Square s, Bitboard occupied) const {
|
|||||||
|
|
||||||
bool Position::attackers_to_exist(Square s, Bitboard occupied, Color c) const {
|
bool Position::attackers_to_exist(Square s, Bitboard occupied, Color c) const {
|
||||||
|
|
||||||
return ((attacks_bb<ROOK>(s) & pieces(c, ROOK, QUEEN))
|
return (attacks_bb<ROOK>(s, occupied) & pieces(c, ROOK, QUEEN))
|
||||||
&& (attacks_bb<ROOK>(s, occupied) & pieces(c, ROOK, QUEEN)))
|
|| (attacks_bb<BISHOP>(s, occupied) & pieces(c, BISHOP, QUEEN))
|
||||||
|| ((attacks_bb<BISHOP>(s) & pieces(c, BISHOP, QUEEN))
|
|| (attacks_bb<PAWN>(s, ~c) & pieces(c, PAWN))
|
||||||
&& (attacks_bb<BISHOP>(s, occupied) & pieces(c, BISHOP, QUEEN)))
|
|| (attacks_bb<KNIGHT>(s) & pieces(c, KNIGHT)) || (attacks_bb<KING>(s) & pieces(c, KING));
|
||||||
|| (((attacks_bb<PAWN>(s, ~c) & pieces(PAWN)) | (attacks_bb<KNIGHT>(s) & pieces(KNIGHT))
|
|
||||||
| (attacks_bb<KING>(s) & pieces(KING)))
|
|
||||||
& pieces(c));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests whether a pseudo-legal move is legal
|
// Tests whether a pseudo-legal move is legal
|
||||||
|
|||||||
Reference in New Issue
Block a user