Method: Codebreaker::Console#run

Defined in:
lib/codebreaker_gem/codebreaker.rb

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/codebreaker_gem/codebreaker.rb', line 11

def run
  while @game.attempts > 0  do
    get_guess
    case @guess
      when @game.secret_code
        you_won
        break
      when 'hint'
        @game.get_hint
        show_hint
      else
        @game.guess = @guess
        @game.check
        show_response
      end
  end
  you_loose if @game.attempts <= 0
end