Class: TTT::GameResetter

Inherits:
Object
  • Object
show all
Defined in:
lib/games/tictactoe/game_resetter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gameObject

Returns the value of attribute game.



3
4
5
# File 'lib/games/tictactoe/game_resetter.rb', line 3

def game
  @game
end

Instance Method Details

#reset_boardObject



12
13
14
# File 'lib/games/tictactoe/game_resetter.rb', line 12

def reset_board
  game.board = game.generate_empty_board(game.config)
end

#reset_game(game) ⇒ Object



5
6
7
8
9
10
# File 'lib/games/tictactoe/game_resetter.rb', line 5

def reset_game(game)
  @game = game
  reset_board
  game.number_of_turns_taken = 0
  game.won_flag = false
end