Recreation of JS based math game to Ruby