class GamePrompts
Attributes
intro_message[R]
Public Instance Methods
after_guess(guess, number_correct, position_right)
click to toggle source
# File lib/game_prompts.rb, line 72 def after_guess(guess, number_correct, position_right) 'Your guess ' + "'#{guess.upcase}'".magenta + ' has ' + "#{number_correct}".magenta + ' correct colors with ' + "#{position_right}".magenta + ' in the correct position.' end
game_start()
click to toggle source
# File lib/game_prompts.rb, line 20 def game_start "I have generated a beginner sequence with four elements made up of:\n" + '(r)'.red + 'ed, ' + '(g)'.green + 'reen, ' + '(b)'.light_blue + 'lue, ' + 'and ' + '(y)'.yellow + "ellow.\n Use (q)uit at any time to end the game.\n\n" end
guess_again()
click to toggle source
# File lib/game_prompts.rb, line 60 def guess_again 'The guess must only be 4 colors and either' + ' r, '.red + 'g, '.green + 'b, '.light_blue + 'or y.'.yellow end
guess_count(guess_count)
click to toggle source
# File lib/game_prompts.rb, line 64 def guess_count(guess_count) if guess_count == 1 'You have taken' + " #{guess_count}".red + ' guess.' else 'You have taken ' + " #{guess_count}".red + ' guesses.' end end
guess_prompt()
click to toggle source
# File lib/game_prompts.rb, line 56 def guess_prompt 'Take your guess: '.yellow end
instructions()
click to toggle source
# File lib/game_prompts.rb, line 44 def instructions "A secret combination of colors has been chosen at random.\n\nYour job is to guess the correct sequence in 10 tries or less.\n\nIf you manage to win, you'll join the elite as a mastermind.\n\nIf you lose, the shambolic state of your life will be confirmed.\n\nGood luck!...you'll need it.\n\nPress (p) to play." end
invalid()
click to toggle source
# File lib/game_prompts.rb, line 52 def invalid 'Your argument is invalid. Try again.'.red end
lose()
click to toggle source
# File lib/game_prompts.rb, line 12 def lose 'Nice try you ' + 'DUMMY. '.blue.bold + play_again end
mastermind_logo()
click to toggle source
# File lib/game_prompts.rb, line 24 def mastermind_logo puts %q{ _ _ _ | | (_) | | _ __ ___ __ _ ___| |_ ___ _ __ _ __ ___ _ _ __ __| | | '_ ` _ \ / _` / __| __/ _ \ '__| '_ ` _ \| | '_ \ / _` | | | | | | | (_| \__ \ || __/ | | | | | | | | | | | (_| | |_| |_| |_|\__,_|___/\__\___|_| |_| |_| |_|_|_| |_|\__,_| }.cyan end
play()
click to toggle source
# File lib/game_prompts.rb, line 36 def play 'begin the game.' end
play_again()
click to toggle source
# File lib/game_prompts.rb, line 76 def play_again '(p)lay again or (q)uit?' end
player_input()
click to toggle source
# File lib/game_prompts.rb, line 40 def player_input 'Enter Choice: '.yellow end
quit()
click to toggle source
# File lib/game_prompts.rb, line 48 def quit 'Your father was right about you, you are a quitter.'.red end
winner(answer, guess_count, minutes, seconds)
click to toggle source
# File lib/game_prompts.rb, line 16 def winner(answer, guess_count, minutes, seconds) "WINNER! You guessed the sequence '#{answer.join('').upcase}' with #{guess_count} guesses in #{minutes} minutes and #{seconds} seconds. \n(p)lay again or (q)uit?" end