Refactored mathgame.rb