- if (Type == MV_CAPTURE)
- target = pos.pieces(flip(us));
-
- else if (Type == MV_NON_CAPTURE)
- target = pos.empty_squares();
-
- else if (Type == MV_NON_EVASION)
- target = pos.pieces(flip(us)) | pos.empty_squares();
-
- 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 && pos.can_castle(us))
- {
- mlist = generate_castle_moves<KING_SIDE>(pos, mlist, us);
- mlist = generate_castle_moves<QUEEN_SIDE>(pos, mlist, us);
- }