Class: MM::GameResetter

Inherits:
Object
  • Object
show all
Defined in:
lib/games/mastermind/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/mastermind/game_resetter.rb', line 3

def game
  @game
end

Instance Method Details

#reset_boardObject



15
16
17
# File 'lib/games/mastermind/game_resetter.rb', line 15

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

#reset_game(game) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/games/mastermind/game_resetter.rb', line 5

def reset_game(game)
  @game = game
  reset_board
  game.number_of_turns_taken = 0
  game.won_flag = false
  game.secret_code = game.set_secret_code
  game.current_guess = []
  game.current_result = []
end