Key exclusion;
}
-Key Position::exclusion_key() const { return st->key ^ Zobrist::exclusion;}
+Key Position::exclusion_key() const { return st->key ^ Zobrist::exclusion; }
namespace {
stm = color_of(piece_on(from));
occupied = pieces() ^ from;
- // Castling moves are implemented as king capturing the rook so cannot be
- // handled correctly. Simply return 0 that is always the correct value
+ // Castling moves are implemented as king capturing the rook so cannot
+ // be handled correctly. Simply return VALUE_ZERO that is always correct
// unless in the rare case the rook ends up under attack.
if (type_of(m) == CASTLING)
return VALUE_ZERO;
// Locate and remove the next least valuable attacker
captured = min_attacker<PAWN>(byTypeBB, to, stmAttackers, occupied, attackers);
-
- // Stop before processing a king capture
- if (captured == KING)
- {
- if (stmAttackers == attackers)
- ++slIndex;
-
- break;
- }
-
stm = ~stm;
stmAttackers = attackers & pieces(stm);
++slIndex;
- } while (stmAttackers);
+ } while (stmAttackers && (captured != KING || (--slIndex, false))); // Stop before a king capture
// Having built the swap list, we negamax through it to find the best
// achievable score from the point of view of the side to move.