X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=2bdf1009b28ce8c006cd5cebd825202310dee943;hp=21eff88c46898b46ca5e4fb86578f45bb895d8aa;hb=c8589903777b6e0289640b43fae966ded442af48;hpb=3c576efa77f431cf3687881b8fd6a728e87ed97d diff --git a/src/position.cpp b/src/position.cpp index 21eff88c..2bdf1009 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -18,7 +18,6 @@ along with this program. If not, see . */ -#include #include #include // For offsetof() #include // For std::memset, std::memcmp @@ -498,14 +497,15 @@ Bitboard Position::slider_blockers(Bitboard sliders, Square s, Bitboard& pinners Bitboard blockers = 0; pinners = 0; - // Snipers are sliders that attack 's' when a piece is removed + // Snipers are sliders that attack 's' when a piece and other snipers are removed Bitboard snipers = ( (PseudoAttacks[ ROOK][s] & pieces(QUEEN, ROOK)) | (PseudoAttacks[BISHOP][s] & pieces(QUEEN, BISHOP))) & sliders; + Bitboard occupancy = pieces() & ~snipers; while (snipers) { Square sniperSq = pop_lsb(&snipers); - Bitboard b = between_bb(s, sniperSq) & pieces(); + Bitboard b = between_bb(s, sniperSq) & occupancy; if (b && !more_than_one(b)) { @@ -1076,8 +1076,8 @@ bool Position::see_ge(Move m, Value threshold) const { stmAttackers = attackers & pieces(stm); // Don't allow pinned pieces to attack (except the king) as long as - // all pinners are on their original square. - if (!(st->pinners[~stm] & ~occupied)) + // any pinners are on their original square. + if (st->pinners[~stm] & occupied) stmAttackers &= ~st->blockersForKing[stm]; // If stm has no more attackers then give up: stm loses