- Color us = pos.side_to_move();
- Bitboard target = pos.pieces_of_color(opposite_color(us));
-
- mlist = generate_piece_moves<QUEEN>(pos, mlist, us, target);
- mlist = generate_piece_moves<ROOK>(pos, mlist, us, target);
- mlist = generate_piece_moves<BISHOP>(pos, mlist, us, target);
- mlist = generate_piece_moves<KNIGHT>(pos, mlist, us, target);
- mlist = generate_piece_moves<PAWN, CAPTURE>(pos, mlist, us);
- return generate_piece_moves<KING>(pos, mlist, us, target);
-}
-
-
-/// generate_noncaptures() generates all pseudo-legal non-captures and
-/// underpromotions. Returns a pointer to the end of the move list.
-
-MoveStack* generate_noncaptures(const Position& pos, MoveStack* mlist) {
-
- assert(pos.is_ok());
- assert(!pos.is_check());
-
- Color us = pos.side_to_move();
- Bitboard target = pos.empty_squares();
-
- mlist = generate_piece_moves<PAWN, NON_CAPTURE>(pos, mlist, us);
- mlist = generate_piece_moves<KNIGHT>(pos, mlist, us, target);
- mlist = generate_piece_moves<BISHOP>(pos, mlist, us, target);
- mlist = generate_piece_moves<ROOK>(pos, mlist, us, target);
- mlist = generate_piece_moves<QUEEN>(pos, mlist, us, target);
- mlist = generate_piece_moves<KING>(pos, mlist, us, target);
- mlist = generate_castle_moves<KING_SIDE>(pos, mlist);
- return generate_castle_moves<QUEEN_SIDE>(pos, mlist);
-}
-
-
-/// generate_non_capture_checks() generates all pseudo-legal non-capturing,
-/// non-promoting checks. Returns a pointer to the end of the move list.
-
-MoveStack* generate_non_capture_checks(const Position& pos, MoveStack* mlist, Bitboard dc) {
-
- assert(pos.is_ok());
- assert(!pos.is_check());
-
- Color us = pos.side_to_move();
- Square ksq = pos.king_square(opposite_color(us));
-
- assert(pos.piece_on(ksq) == piece_of_color_and_type(opposite_color(us), KING));
-
- // Pieces moves
- mlist = generate_piece_checks<PAWN>(pos, mlist, us, dc, ksq);
- mlist = generate_piece_checks<KNIGHT>(pos, mlist, us, dc, ksq);
- mlist = generate_piece_checks<BISHOP>(pos, mlist, us, dc, ksq);
- mlist = generate_piece_checks<ROOK>(pos, mlist, us, dc, ksq);
- mlist = generate_piece_checks<QUEEN>(pos, mlist, us, dc, ksq);
- mlist = generate_piece_checks<KING>(pos, mlist, us, dc, ksq);
-
- // Castling moves that give check. Very rare but nice to have!
- if ( pos.can_castle_queenside(us)
- && (square_rank(ksq) == square_rank(pos.king_square(us)) || square_file(ksq) == FILE_D)
- && castling_is_check(pos, QUEEN_SIDE))
- mlist = generate_castle_moves<QUEEN_SIDE>(pos, mlist);
-
- if ( pos.can_castle_kingside(us)
- && (square_rank(ksq) == square_rank(pos.king_square(us)) || square_file(ksq) == FILE_F)
- && castling_is_check(pos, KING_SIDE))
- mlist = generate_castle_moves<KING_SIDE>(pos, mlist);
-
- return mlist;
-}
-
-
-/// generate_evasions() generates all check evasions when the side to move is
-/// in check. Unlike the other move generation functions, this one generates
-/// only legal moves. Returns a pointer to the end of the move list.
-
-MoveStack* generate_evasions(const Position& pos, MoveStack* mlist, Bitboard pinned) {
-
- assert(pos.is_ok());
- assert(pos.is_check());
-
- Square from, to;
- Color us = pos.side_to_move();
- Color them = opposite_color(us);
- Square ksq = pos.king_square(us);
-
- assert(pos.piece_on(ksq) == piece_of_color_and_type(us, KING));
-
- // The bitboard of occupied pieces without our king
- Bitboard b_noKing = pos.occupied_squares();
- clear_bit(&b_noKing, ksq);
-
- // Find squares attacked by slider checkers, we will
- // remove them from king evasions set so to avoid a couple
- // of cycles in the slow king evasions legality check loop
- // and to be able to use attackers_to().
- Bitboard checkers = pos.checkers();
- Bitboard checkersAttacks = EmptyBoardBB;
- Bitboard b = checkers & pos.pieces(BISHOP, QUEEN);
- while (b)
- {
- from = pop_1st_bit(&b);
- checkersAttacks |= bishop_attacks_bb(from, b_noKing);
- }
-
- b = checkers & pos.pieces(ROOK, QUEEN);
- while (b)
- {
- from = pop_1st_bit(&b);
- checkersAttacks |= rook_attacks_bb(from, b_noKing);
- }