Class: Mastermind::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/mastermind.rb

Instance Method Summary collapse

Constructor Details

#initialize(game_text, terminal) ⇒ Game

Returns a new instance of Game.



8
9
10
11
12
# File 'lib/mastermind.rb', line 8

def initialize(game_text, terminal)
  @game_text = game_text
  @terminal = terminal
  @code_length = 4
end

Instance Method Details

#play_gameObject



14
15
16
17
18
19
20
21
# File 'lib/mastermind.rb', line 14

def play_game
  @terminal.display(@game_text.message(:welcome))
  colors = get_color_scheme
  code = get_input(colors)
  set_up_board(code, colors)
  result = run_ai_player(colors)
  end_of_game(result)
end