class CodebreakerVukolovEdition::Messages

Constants

INFO_MESSAGES

Public Instance Methods

before_round_info(turns) click to toggle source
# File lib/messages.rb, line 17
def before_round_info(turns)
  puts "====================== round ##{turns + 1} ======================
  You have #{CodebreakerVukolovEdition::Game::MAX_TURNS - turns} turns for breaking this code"
end
hint_info() click to toggle source
# File lib/messages.rb, line 26
def hint_info
  puts "(*) Also, you can use hint (the system reveals one of the numbers in the secret code). If you need a hint, please put 'hint'"
end
print_hint(hint) click to toggle source
show_messages(symbol, *arg) click to toggle source
# File lib/messages.rb, line 41
def show_messages(symbol, *arg)
  message = arg.empty? ? INFO_MESSAGES[symbol] : INFO_MESSAGES[symbol] + arg.first
  puts message
end
total_game_info(state, turns, secret_code) click to toggle source
# File lib/messages.rb, line 30
def total_game_info(state, turns, secret_code)
  case state
  when :won
    puts "
    Congratulation!!!!
    You have hacked this code by #{turns} turns, the code is #{secret_code.join('')}"
  when :lose
    puts "Unfortunately you spent all your turns (#{turns}) and didn't brake the code. Code was #{secret_code.join('')}"
  end
end