Class: Codebreaker::ConsoleApp

Inherits:
Object
  • Object
show all
Defined in:
lib/ep-codebreaker/console_app.rb

Instance Method Summary collapse

Constructor Details

#initializeConsoleApp

Returns a new instance of ConsoleApp.



7
8
9
# File 'lib/ep-codebreaker/console_app.rb', line 7

def initialize
  @game = Game.new
end

Instance Method Details

#runObject



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

def run
  Messages.
  Messages.welcome

  loop do
    Messages.run
    print '> '

    case gets.chomp
    when '1' then play
    when '2' then puts high_scores
    when '0'
      Messages.bye
      break
    else Messages.wrong_option
    end
  end
end