We have built a code to obtain the exact solutions of Riemann problems in ideal magnetohydrodynamics (MHD) for an arbitrary initial condition. The code can handle not only regular waves but also switch-on/off rarefactions and all types of non-regular shocks: intermediate shocks and switch-on/off shocks. Furthermore, the initial conditions with vanishing normal or transverse magnetic fields can be handled, although the code is partly based on the algorithm proposed by Torrilhon (2002) (Torrilhon, M. 2002 Exact solver and uniqueness condition for Riemann problems of ideal magnetohydrodynamics. Research report 2002-06, Seminar for Applied Mathematics, ETH, Zurich, Switzerland), which cannot deal with all types of non-regular waves nor the initial conditions without normal or transverse magnetic fields. Our solver can find all the solutions for a given Riemann problem, and hence, as demonstrated in this paper, one can investigate the structure of the solution space in detail. Therefore, the solver is a powerful instrument to solve the outstanding problem of existence and uniqueness of solutions of MHD Riemann problems. Moreover, the solver may be applied to numerical MHD schemes like the Godunov scheme in the future.