+ assert(pos.is_ok());
+ assert(!pos.is_check());
+
+ Color us = pos.side_to_move();
+ Bitboard target = pos.pieces_of_color(opposite_color(us));
+
+ mlist = generate_piece_moves<PAWN, CAPTURE>(pos, mlist, us, target);
+ mlist = generate_piece_moves<PAWN, NON_CAPTURE>(pos, mlist, us, pos.empty_squares());
+
+ target |= pos.empty_squares();
+
+ 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-captures and knight
+/// underpromotions that give check. Returns a pointer to the end of the move list.
+template<>
+MoveStack* generate<NON_CAPTURE_CHECKS>(const Position& pos, MoveStack* mlist) {