Class: GamePrompts
- Inherits:
-
Object
- Object
- GamePrompts
- Defined in:
- lib/game_prompts.rb
Instance Attribute Summary collapse
-
#intro_message ⇒ Object
readonly
> nil.
Instance Method Summary collapse
- #after_guess(guess, number_correct, position_right) ⇒ Object
- #game_start ⇒ Object
- #guess_again ⇒ Object
- #guess_count(guess_count) ⇒ Object
- #guess_prompt ⇒ Object
- #instructions ⇒ Object
- #invalid ⇒ Object
- #lose ⇒ Object
- #mastermind_logo ⇒ Object
- #play ⇒ Object
- #play_again ⇒ Object
- #player_input ⇒ Object
- #quit ⇒ Object
- #winner(answer, guess_count, minutes, seconds) ⇒ Object
Instance Attribute Details
#intro_message ⇒ Object (readonly)
> nil
2 3 4 |
# File 'lib/game_prompts.rb', line 2 def @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_start ⇒ Object
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_again ⇒ Object
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_prompt ⇒ Object
55 56 57 |
# File 'lib/game_prompts.rb', line 55 def guess_prompt "Take your guess: " end |
#instructions ⇒ Object
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 |
#invalid ⇒ Object
51 52 53 |
# File 'lib/game_prompts.rb', line 51 def invalid "Your argument is invalid. Try again." end |
#lose ⇒ Object
10 11 12 |
# File 'lib/game_prompts.rb', line 10 def lose "Nice try you dummy." + play_again end |
#mastermind_logo ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/game_prompts.rb', line 22 def mastermind_logo puts %q{ _ _ _ | | (_) | | _ __ ___ __ _ ___| |_ ___ _ __ _ __ ___ _ _ __ __| | | '_ ` _ \ / _` / __| __/ _ \ '__| '_ ` _ \| | '_ \ / _` | | | | | | | (_| \__ \ || __/ | | | | | | | | | | | (_| | |_| |_| |_|\__,_|___/\__\___|_| |_| |_| |_|_|_| |_|\__,_| } end |
#play ⇒ Object
35 36 37 |
# File 'lib/game_prompts.rb', line 35 def play "begin the game." end |
#play_again ⇒ Object
75 76 77 |
# File 'lib/game_prompts.rb', line 75 def play_again "(p)lay again or (q)uit?" end |
#player_input ⇒ Object
39 40 41 |
# File 'lib/game_prompts.rb', line 39 def player_input "Enter Choice: " end |
#quit ⇒ Object
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 |