refactor to remove global variables from game.rb, make game engine method a class method of Game