Class: GamePrompts

Inherits:
Object
  • Object
show all
Defined in:
lib/game_prompts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#intro_messageObject (readonly)

> nil



4
5
6
# File 'lib/game_prompts.rb', line 4

def intro_message
  @intro_message
end

Instance Method Details

#after_guess(guess, number_correct, position_right) ⇒ Object



73
74
75
# File 'lib/game_prompts.rb', line 73

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_startObject



20
21
22
# 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."
end

#guess_againObject



61
62
63
# File 'lib/game_prompts.rb', line 61

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) ⇒ Object



65
66
67
68
69
70
71
# File 'lib/game_prompts.rb', line 65

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_promptObject



57
58
59
# File 'lib/game_prompts.rb', line 57

def guess_prompt
  "Take your guess: ".yellow
end

#instructionsObject



45
46
47
# File 'lib/game_prompts.rb', line 45

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

#invalidObject



53
54
55
# File 'lib/game_prompts.rb', line 53

def invalid
  "Your argument is invalid. Try again.".red
end

#loseObject



12
13
14
# File 'lib/game_prompts.rb', line 12

def lose
  "Nice try you " + "DUMMY. ".blue.bold + play_again
end

#mastermind_logoObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/game_prompts.rb', line 24

def 
puts
%q{
                    _                      _           _
                   | |                    (_)         | |
_ __ ___   __ _ ___| |_ ___ _ __ _ __ ___  _ _ __   __| |
 | '_ ` _ \ / _` / __| __/ _ \ '__| '_ ` _ \| | '_ \ / _` |
 | | | | | | (_| \__ \ ||  __/ |  | | | | | | | | | | (_| |
 |_| |_| |_|\__,_|___/\__\___|_|  |_| |_| |_|_|_| |_|\__,_|
 }.cyan

end

#playObject



37
38
39
# File 'lib/game_prompts.rb', line 37

def play
  "begin the game."
end

#play_againObject



77
78
79
# File 'lib/game_prompts.rb', line 77

def play_again
  "(p)lay again or (q)uit?"
end

#player_inputObject



41
42
43
# File 'lib/game_prompts.rb', line 41

def player_input
  "Enter Choice: ".yellow
end

#quitObject



49
50
51
# File 'lib/game_prompts.rb', line 49

def quit
  "Your father was right about you, you are a quitter.".red
end

#winner(answer, guess_count, minutes, seconds) ⇒ Object



16
17
18
# 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