QUEEN_SIDE
};
- static const bool CAPTURE = true;
- static const bool NON_CAPTURE = false;
+ const bool CAPTURE = true;
+ const bool NON_CAPTURE = false;
- // Function
+ // Functions
bool castling_is_check(const Position&, CastlingSide);
// Helper templates
template<>
inline MoveStack* generate_piece_blocking_evasions<PAWN>(const Position& p, MoveStack* m, Color us,
- Bitboard np, Bitboard bs) {
+ Bitboard np, Bitboard bs) {
if (us == WHITE)
return generate_pawn_blocking_evasions<WHITE, RANK_8, Rank3BB, DELTA_N>(p, np, bs, m);
else
/// only legal moves. It returns the number of generated moves. This
/// function is very ugly, and needs cleaning up some time later. FIXME
-int generate_evasions(const Position& pos, MoveStack* mlist) {
+int generate_evasions(const Position& pos, MoveStack* mlist, Bitboard pinned) {
assert(pos.is_ok());
assert(pos.is_check());
if (!(checkers & (checkers - 1))) // Only one bit set?
{
Square checksq = first_1(checkers);
+ Bitboard not_pinned = ~pinned;
assert(pos.color_of_piece_on(checksq) == them);
- // Find pinned pieces
- Bitboard not_pinned = ~pos.pinned_pieces(us);
-
// Generate captures of the checking piece
// Pawn captures
assert(pos.is_ok());
+ Bitboard pinned = pos.pinned_pieces(pos.side_to_move());
+
if (pos.is_check())
- return generate_evasions(pos, mlist);
+ return generate_evasions(pos, mlist, pinned);
// Generate pseudo-legal moves
int n = generate_captures(pos, mlist);
n += generate_noncaptures(pos, mlist + n);
- Bitboard pinned = pos.pinned_pieces(pos.side_to_move());
-
// Remove illegal moves from the list
for (int i = 0; i < n; i++)
if (!pos.pl_move_is_legal(mlist[i].move, pinned))
// Double pawn pushes
b2 = (Us == WHITE ? b1 << 8 : b1 >> 8) & pos.empty_squares() & TRank3BB;
- b2 = (Us == WHITE ? b2 << 8 : b2 >> 8) & blockSquares;;
+ b2 = (Us == WHITE ? b2 << 8 : b2 >> 8) & blockSquares;
while (b2)
{
to = pop_1st_bit(&b2);