Class: Messages
- Inherits:
-
Object
- Object
- Messages
- Defined in:
- lib/messages.rb
Instance Method Summary collapse
- #blue ⇒ Object
- #color_match(color_match) ⇒ Object
- #colors ⇒ Object
- #command_request ⇒ Object
- #duration(minutes, seconds, tries) ⇒ Object
- #ending ⇒ Object
- #game_command_request ⇒ Object
- #game_instructions ⇒ Object
- #game_intro ⇒ Object
- #green ⇒ Object
- #intro ⇒ Object
- #no_match ⇒ Object
- #not_valid_input ⇒ Object
- #position_color_match(position_color_match) ⇒ Object
- #program_instructions ⇒ Object
- #quit_game ⇒ Object
- #red ⇒ Object
- #too_long ⇒ Object
- #too_short ⇒ Object
- #try_indicator(tries) ⇒ Object
- #winner ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#blue ⇒ Object
65 66 67 |
# File 'lib/messages.rb', line 65 def blue "(b)lue".blue end |
#color_match(color_match) ⇒ Object
45 46 47 |
# File 'lib/messages.rb', line 45 def color_match(color_match) "You have #{color_match} of the correct #{colors}" end |
#colors ⇒ Object
53 54 55 |
# File 'lib/messages.rb', line 53 def colors "c".red + "o".yellow + "l".blue + "o".green + "r".red + "(s)".yellow end |
#command_request ⇒ Object
24 25 26 |
# File 'lib/messages.rb', line 24 def command_request "MAIN MENU: Enter a command[(q)uit, (i)nstructions, or (p)play] : " end |
#duration(minutes, seconds, tries) ⇒ Object
41 42 43 |
# File 'lib/messages.rb', line 41 def duration(minutes, seconds, tries) "It took you #{tries} tries over #{minutes} minutes and #{seconds} seconds to finish." end |
#ending ⇒ Object
69 70 71 |
# File 'lib/messages.rb', line 69 def ending "Good bye." end |
#game_command_request ⇒ Object
78 79 80 |
# File 'lib/messages.rb', line 78 def game_command_request "Enter colors (or 'q' for quit):" end |
#game_instructions ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/messages.rb', line 28 def game_instructions puts "Once the game begins, a secret code will be generated consisting of 4 elements, "\ "#{red}, #{yellow}, #{green}, #{blue}. This code will be hidden from you."\ " Your task is to guess the code in the least number of trys.\nAlong the way,"\ "you will be given hints about the code, until you guess the correct code.\n"\ "Guess wisely, he who has the least amount of guesses wins!\n The code consists of 4 elements: " end |
#game_intro ⇒ Object
73 74 75 76 |
# File 'lib/messages.rb', line 73 def game_intro "I have generated a beginner sequence with four elements made up of:"\ "#{red},#{green}, #{blue}, and #{yellow}." end |
#green ⇒ Object
61 62 63 |
# File 'lib/messages.rb', line 61 def green "(g)reen".green end |
#intro ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/messages.rb', line 6 def intro print "\e[2J\e[f" puts' _____ __ .__ .___ '.magenta puts' / \ _____ _______/ |_ ___________ _____ |__| ____ __| _/ '.magenta puts' / \ / \__ \ / ___/\ __\/ __ \_ __ \/ \| |/ \ / __ | '.magenta puts' / Y \/ __ \_\___ \ | | \ ___/| | \/ Y Y \ | | \/ /_/ | '.magenta puts' \____|__ (____ /____ > |__| \___ >__| |__|_| /__|___| /\____ | '.magenta puts' \/ \/ \/ \/ \/ \/ \/ '.magenta puts "\n" + program_instructions end |
#no_match ⇒ Object
98 99 100 |
# File 'lib/messages.rb', line 98 def no_match "NOT A MATCH".magenta end |
#not_valid_input ⇒ Object
90 91 92 |
# File 'lib/messages.rb', line 90 def not_valid_input "Input not valid. Please enter (r)ed, (g)reen, (b)lue, or (y)ellow" end |
#position_color_match(position_color_match) ⇒ Object
49 50 51 |
# File 'lib/messages.rb', line 49 def position_color_match(position_color_match) puts "you have #{position_color_match} #{colors} in the correct position" end |
#program_instructions ⇒ Object
20 21 22 |
# File 'lib/messages.rb', line 20 def program_instructions "To Play Enter '(p)lay', For Instructions Enter '(i)nstructions', To Quit At Anytime Enter '(q)uit' " end |
#quit_game ⇒ Object
86 87 88 |
# File 'lib/messages.rb', line 86 def quit_game "Exiting game. Press 'q' to quit" end |
#red ⇒ Object
37 38 39 |
# File 'lib/messages.rb', line 37 def red "(r)ed".red end |
#too_long ⇒ Object
106 107 108 |
# File 'lib/messages.rb', line 106 def too_long "The code you entered is too long." end |
#too_short ⇒ Object
102 103 104 |
# File 'lib/messages.rb', line 102 def too_short "The code you entered is too short." end |
#try_indicator(tries) ⇒ Object
82 83 84 |
# File 'lib/messages.rb', line 82 def try_indicator(tries) "This is try number #{tries}" end |
#winner ⇒ Object
94 95 96 |
# File 'lib/messages.rb', line 94 def winner "YOU".red + " WON".blue + "!!!".green + "!!!".yellow end |
#yellow ⇒ Object
57 58 59 |
# File 'lib/messages.rb', line 57 def yellow "(y)ellow".yellow end |