/// generate_checks() generates all pseudo-legal non-capturing, non-promoting
/// checks. It returns the number of generated moves.
/// generate_checks() generates all pseudo-legal non-capturing, non-promoting
/// checks. It returns the number of generated moves.
// Pieces moves
mlist = generate_piece_checks<PAWN>(pos, mlist, us, dc, ksq);
// Pieces moves
mlist = generate_piece_checks<PAWN>(pos, mlist, us, dc, ksq);
/// in check. Unlike the other move generation functions, this one generates
/// only legal moves. It returns the number of generated moves.
/// in check. Unlike the other move generation functions, this one generates
/// only legal moves. It returns the number of generated moves.
// Generate pseudo-legal moves
int n = generate_captures(pos, mlist);
// Generate pseudo-legal moves
int n = generate_captures(pos, mlist);
/// returned. If not, the function returns false. This function must
/// only be used when the side to move is not in check.
/// returned. If not, the function returns false. This function must
/// only be used when the side to move is not in check.
Color us = pos.side_to_move();
Color them = opposite_color(us);
Square from = move_from(m);
Piece pc = pos.piece_on(from);
Color us = pos.side_to_move();
Color them = opposite_color(us);
Square from = move_from(m);
Piece pc = pos.piece_on(from);
// If the from square is not occupied by a piece belonging to the side to
// move, the move is obviously not legal.
// If the from square is not occupied by a piece belonging to the side to
// move, the move is obviously not legal.
Square g1 = relative_square(us, SQ_G1);
Square f1 = relative_square(us, SQ_F1);
Square g1 = relative_square(us, SQ_G1);
Square f1 = relative_square(us, SQ_F1);
Square c1 = relative_square(us, SQ_C1);
Square d1 = relative_square(us, SQ_D1);
Square c1 = relative_square(us, SQ_C1);
Square d1 = relative_square(us, SQ_D1);
}
// Luckly we can handle all the other pieces in one go
return ( pos.piece_attacks_square(pos.piece_on(from), from, to)
}
// Luckly we can handle all the other pieces in one go
return ( pos.piece_attacks_square(pos.piece_on(from), from, to)
Square rsq = (Side == KING_SIDE ? pos.initial_kr_square(us) : pos.initial_qr_square(us));
Square s1 = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1);
Square rsq = (Side == KING_SIDE ? pos.initial_kr_square(us) : pos.initial_qr_square(us));
Square s1 = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1);
// It is a bit complicated to correctly handle Chess960
for (s = Min(ksq, s1); s <= Max(ksq, s1); s++)
// It is a bit complicated to correctly handle Chess960
for (s = Min(ksq, s1); s <= Max(ksq, s1); s++)