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



2
3
4
# File 'lib/game_prompts.rb', line 2

def intro_message
  @intro_message
end

Instance Method Details

#after_guess(guess, number_correct, position_right) ⇒ Object



71
72
73
# File 'lib/game_prompts.rb', line 71

def after_guess(guess,number_correct, position_right)
  "Your guess '#{guess.upcase}' has #{number_correct} correct colors with #{position_right} in the correct position."
end

#game_startObject



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

def game_start
  "I have generated a beginner sequence with four elements made up of: (r)ed, (g)reen, (b)lue, and (y)ellow. Use (q)uit at any time to end the game."
end

#guess_againObject



59
60
61
# File 'lib/game_prompts.rb', line 59

def guess_again
  "The guess must only be 4 colors and either r, g, b, or y."
end

#guess_count(guess_count) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/game_prompts.rb', line 63

def guess_count(guess_count)
  if guess_count == 1
    "You have taken #{guess_count} guess."
  else
    "You have taken #{guess_count} guesses."
  end
end

#guess_promptObject



55
56
57
# File 'lib/game_prompts.rb', line 55

def guess_prompt
  "Take your guess: "
end

#instructionsObject



43
44
45
# File 'lib/game_prompts.rb', line 43

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



51
52
53
# File 'lib/game_prompts.rb', line 51

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

#loseObject



10
11
12
# File 'lib/game_prompts.rb', line 10

def lose
  "Nice try you dummy." + play_again
end

#mastermind_logoObject



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

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

end

#playObject



35
36
37
# File 'lib/game_prompts.rb', line 35

def play
  "begin the game."
end

#play_againObject



75
76
77
# File 'lib/game_prompts.rb', line 75

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

#player_inputObject



39
40
41
# File 'lib/game_prompts.rb', line 39

def player_input
  "Enter Choice: "
end

#quitObject



47
48
49
# File 'lib/game_prompts.rb', line 47

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

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



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

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