Module: UiHelper

Included in:
Codebreaker::UserInterface
Defined in:
lib/codebreaker/user_interface_helper.rb

Instance Method Summary collapse

Instance Method Details

#after_game_messageObject



34
35
36
# File 'lib/codebreaker/user_interface_helper.rb', line 34

def after_game_message
  puts 'Do you want to play again(y/n) or save score(s)?'
end

#greeting_messageObject



4
5
6
7
# File 'lib/codebreaker/user_interface_helper.rb', line 4

def greeting_message
  puts '***Welcome to the Codebreaker game!***'
  puts "Enter any characters to start playing or 'exit' for exit"
end

#incorrect_format_messageObject



22
23
24
# File 'lib/codebreaker/user_interface_helper.rb', line 22

def incorrect_format_message
  puts 'Incoorect format! Please enter 4 digits from 1 to 6'
end

#lost_messageObject



30
31
32
# File 'lib/codebreaker/user_interface_helper.rb', line 30

def lost_message
  puts 'You used all of attempts. You lost :('
end

#no_hints_messageObject



18
19
20
# File 'lib/codebreaker/user_interface_helper.rb', line 18

def no_hints_message
  puts 'You used all of hints!'
end

#saved_result_messageObject



38
39
40
# File 'lib/codebreaker/user_interface_helper.rb', line 38

def saved_result_message
  puts 'Your result has been saved'
end

#start_game_messageObject



9
10
11
12
# File 'lib/codebreaker/user_interface_helper.rb', line 9

def start_game_message
  puts "Please, enter your code to make guess or 'h' to get a hint"
  puts "You have #{Codebreaker::Game::ATTEMPTS} attempts and #{Codebreaker::Game::HINTS} hints"
end

#used_attempts_messageObject



14
15
16
# File 'lib/codebreaker/user_interface_helper.rb', line 14

def used_attempts_message
  puts "You used #{@game.used_attempts} attempts." if @game.used_attempts > 0
end

#won_messageObject



26
27
28
# File 'lib/codebreaker/user_interface_helper.rb', line 26

def won_message
  puts '***Congratulations, you won!***'
end