Class: Codebreaker::Interface
- Inherits:
-
Object
- Object
- Codebreaker::Interface
- Includes:
- Ui
- Defined in:
- lib/rk/codebreaker/interface.rb
Instance Method Summary collapse
- #game_begin ⇒ Object
-
#initialize ⇒ Interface
constructor
A new instance of Interface.
Methods included from Ui
#goodbye, #greeting, #lucky_combination, #new_game_proposition, #no_attempts, #no_hint, #proposal_and_input, #save_result_proposition, #username
Constructor Details
#initialize ⇒ Interface
Returns a new instance of Interface.
8 9 10 11 |
# File 'lib/rk/codebreaker/interface.rb', line 8 def initialize @game = Game.new greeting end |
Instance Method Details
#game_begin ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rk/codebreaker/interface.rb', line 13 def game_begin while @game.available_attempts > 0 guess = proposal_and_input next if hint_call?(guess) rez = @game.check_input(guess) puts rez break if win?(rez) end no_attempts unless @game.available_attempts > 0 save_result end |