Class: Game
- Inherits:
-
Object
- Object
- Game
- Defined in:
- lib/game.rb
Instance Method Summary collapse
-
#initialize(board, players) ⇒ Game
constructor
A new instance of Game.
- #play ⇒ Object
- #play_specific(move) ⇒ Object
Constructor Details
#initialize(board, players) ⇒ Game
Returns a new instance of Game.
3 4 5 6 |
# File 'lib/game.rb', line 3 def initialize(board, players) @board = board @players = players end |
Instance Method Details
#play ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/game.rb', line 8 def play while game_in_progress? current_player = players[player_symbol] @board = board.make_move(current_player.choose_move(board), player_symbol) end board end |
#play_specific(move) ⇒ Object
16 17 18 19 |
# File 'lib/game.rb', line 16 def play_specific(move) @board = board.make_move(move, player_symbol) play end |