-}
-
-////
-//// Functions
-////
-
-
-/// generate<MV_CAPTURE> generates all pseudo-legal captures and queen
-/// promotions. Returns a pointer to the end of the move list.
-///
-/// generate<MV_NON_CAPTURE> generates all pseudo-legal non-captures and
-/// underpromotions. Returns a pointer to the end of the move list.
-///
-/// generate<MV_NON_EVASION> generates all pseudo-legal captures and
-/// non-captures. Returns a pointer to the end of the move list.
-
-template<MoveType Type>
-MoveStack* generate(const Position& pos, MoveStack* mlist) {
-
- assert(pos.is_ok());
- assert(!pos.is_check());
-
- Color us = pos.side_to_move();
- Bitboard target;
-
- if (Type == MV_CAPTURE || Type == MV_NON_EVASION)
- target = pos.pieces_of_color(opposite_color(us));
- else if (Type == MV_NON_CAPTURE)
- target = pos.empty_squares();
- else
- assert(false);
-
- if (Type == MV_NON_EVASION)
- {
- mlist = generate_piece_moves<PAWN, MV_CAPTURE>(pos, mlist, us, target);
- mlist = generate_piece_moves<PAWN, MV_NON_CAPTURE>(pos, mlist, us, pos.empty_squares());
- target |= pos.empty_squares();
- }
- else
- mlist = generate_piece_moves<PAWN, Type>(pos, mlist, us, target);
-
- 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);
-
- if (Type != MV_CAPTURE)
- {
- if (pos.can_castle_kingside(us))
- mlist = generate_castle_moves<KING_SIDE>(pos, mlist, us);
-
- if (pos.can_castle_queenside(us))
- mlist = generate_castle_moves<QUEEN_SIDE>(pos, mlist, us);
- }
-
- return mlist;
-}
-
-// Explicit template instantiation
-template MoveStack* generate<MV_CAPTURE>(const Position& pos, MoveStack* mlist);
-template MoveStack* generate<MV_NON_CAPTURE>(const Position& pos, MoveStack* mlist);
-template MoveStack* generate<MV_NON_EVASION>(const Position& pos, MoveStack* mlist);