X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fposition.cpp;h=84892d094a60fd3d770b1af0ba2546724ef7b8a9;hb=49a1fdd3fe894d170a2c2781238c0f0f907c08cc;hp=21eff88c46898b46ca5e4fb86578f45bb895d8aa;hpb=3c576efa77f431cf3687881b8fd6a728e87ed97d;p=stockfish
diff --git a/src/position.cpp b/src/position.cpp
index 21eff88c..84892d09 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))
{
@@ -628,7 +628,7 @@ bool Position::pseudo_legal(const Move m) const {
{
// We have already handled promotion moves, so destination
// cannot be on the 8th/1st rank.
- if (rank_of(to) == relative_rank(us, RANK_8))
+ if ((Rank8BB | Rank1BB) & to)
return false;
if ( !(attacks_from(from, us) & pieces(~us) & to) // Not a capture
@@ -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