added game.rb file and refactoring