Module: EatTheOcean::Printer
- Defined in:
- lib/printer.rb,
lib/eat_the_ocean/printer.rb
Class Method Summary collapse
- .already_guessed ⇒ Object
- .blocked ⇒ Object
- .comp_guess_right ⇒ Object
- .comp_guess_wrong ⇒ Object
- .comp_one_by_five_sunk ⇒ Object
- .comp_one_by_four_sunk ⇒ Object
- .comp_one_by_three_sunk ⇒ Object
- .comp_one_by_two_sunk ⇒ Object
- .first_boat_loop ⇒ Object
- .fourth_boat_loop ⇒ Object
- .guess_opponent_coordinate ⇒ Object
- .instructions ⇒ Object
- .invalid_input ⇒ Object
- .next_coordinate ⇒ Object
- .not_in_line ⇒ Object
- .one_by_five_sunk ⇒ Object
- .one_by_four_sunk ⇒ Object
- .one_by_three_sunk ⇒ Object
- .one_by_two_sunk ⇒ Object
- .opponent_map ⇒ Object
- .prompt_first_guess ⇒ Object
- .second_boat_loop ⇒ Object
- .third_boat_loop ⇒ Object
- .title ⇒ Object
- .user_guess_right ⇒ Object
- .user_guess_wrong ⇒ Object
- .user_map ⇒ Object
- .welcome ⇒ Object
- .whats_your_guess ⇒ Object
- .you_win ⇒ Object
Class Method Details
.already_guessed ⇒ Object
91 92 93 |
# File 'lib/printer.rb', line 91 def self.already_guessed "You've already guessed this. Please guess again." end |
.blocked ⇒ Object
32 33 34 |
# File 'lib/printer.rb', line 32 def self.blocked "\nThis ship is overlapping another. Not okay.".colorize(:red) end |
.comp_guess_right ⇒ Object
58 59 60 |
# File 'lib/printer.rb', line 58 def self.comp_guess_right "Looks like the computer harvested a critter. Do androids even like blubber?" end |
.comp_guess_wrong ⇒ Object
62 63 64 |
# File 'lib/printer.rb', line 62 def self.comp_guess_wrong "The computer was too random and missed on " end |
.comp_one_by_five_sunk ⇒ Object
123 124 125 |
# File 'lib/printer.rb', line 123 def self.comp_one_by_five_sunk "The computer has eaten ALL your adult whales...:(" end |
.comp_one_by_four_sunk ⇒ Object
119 120 121 |
# File 'lib/printer.rb', line 119 def self.comp_one_by_four_sunk "The computer has eaten ALL your baby whales...:(" end |
.comp_one_by_three_sunk ⇒ Object
115 116 117 |
# File 'lib/printer.rb', line 115 def self.comp_one_by_three_sunk "The computer has eaten ALL your dolphins...:(" end |
.comp_one_by_two_sunk ⇒ Object
111 112 113 |
# File 'lib/printer.rb', line 111 def self.comp_one_by_two_sunk "The computer has eaten ALL your octopi...:(" end |
.first_boat_loop ⇒ Object
8 9 10 |
# File 'lib/printer.rb', line 8 def self.first_boat_loop "\nPlease enter the coordinates for your octopi (1x2). Please do one coordinate at a time. They must be in a line." end |
.fourth_boat_loop ⇒ Object
20 21 22 |
# File 'lib/printer.rb', line 20 def self.fourth_boat_loop "\nPlease enter the coordinates for your adult whales (1x5). Please do one coordinate at a time. They must be in a line." end |
.guess_opponent_coordinate ⇒ Object
127 128 129 |
# File 'lib/printer.rb', line 127 def self.guess_opponent_coordinate "Please guess where the computer's marine life is." end |
.instructions ⇒ Object
78 79 80 81 |
# File 'lib/printer.rb', line 78 def self.instructions "\n" + "The goal of " + "EAT THE OCEAN".colorize(:blue)+ " is to guess the location of your opponent's swimming mammals," + " octopi".colorize(:red) + "(🐙), taking up 1x2 spaces, " + " dolphins".colorize(:light_blue) +"(🐬), taking up 1x3 spaces," + " baby whales".colorize(:blue) + "(🐳), taking up 1x4 spaces, and" + " adult whales".colorize(:blue) + "(🐋), taking up 1x5 spaces. There are only octopi and dolphins in the easy game (4x4), the addition of baby whales in the medium (6x6), and the further addition of whales in the hard (8x8). Enter any coordinates in the form of 'LETTERnumber', letters A-D and numbers 1-4. The goal is to eat your opponent's entire ocean before it can eat yours. All animals turn into " +"sushi".colorize(:red) + "(🍣) upon being discovered. Missed animals are represented by disruptions in the water," + " water droplets".colorize(:blue) +" (💦). The ocean grid is bordered by " + "big waves".colorize(:blue)+ "(🌊) and "+" Mr. Sun".colorize(:yellow)+" (🌞). Please play " + "(e)asy".colorize(:green) + "," + " (m)edium".colorize(:blue) + ", or " + "(h)ard".colorize(:red) + ". Or (q)uit.\n" end |
.invalid_input ⇒ Object
4 5 6 |
# File 'lib/printer.rb', line 4 def self.invalid_input "Please enter a valid letter-number combination." end |
.next_coordinate ⇒ Object
24 25 26 |
# File 'lib/printer.rb', line 24 def self.next_coordinate "\nNext coordinate?" end |
.not_in_line ⇒ Object
28 29 30 |
# File 'lib/printer.rb', line 28 def self.not_in_line "\nThat was not in a line!".colorize(:red) end |
.one_by_five_sunk ⇒ Object
107 108 109 |
# File 'lib/printer.rb', line 107 def self.one_by_five_sunk "You've eaten all the adult whales...:(" end |
.one_by_four_sunk ⇒ Object
103 104 105 |
# File 'lib/printer.rb', line 103 def self.one_by_four_sunk "You've eaten all the baby whales...:(" end |
.one_by_three_sunk ⇒ Object
99 100 101 |
# File 'lib/printer.rb', line 99 def self.one_by_three_sunk "You've eaten all the dolphins...:(" end |
.one_by_two_sunk ⇒ Object
95 96 97 |
# File 'lib/printer.rb', line 95 def self.one_by_two_sunk "You've eaten all the octopi...:(" end |
.opponent_map ⇒ Object
70 71 72 |
# File 'lib/printer.rb', line 70 def self.opponent_map "Here's how you've done against the computer:" end |
.prompt_first_guess ⇒ Object
87 88 89 |
# File 'lib/printer.rb', line 87 def self.prompt_first_guess "Now you may begin the guessing game." end |
.second_boat_loop ⇒ Object
12 13 14 |
# File 'lib/printer.rb', line 12 def self.second_boat_loop "\nPlease enter the coordinates for your dolphins (1x3). Please do one coordinate at a time. They must be in a line." end |
.third_boat_loop ⇒ Object
16 17 18 |
# File 'lib/printer.rb', line 16 def self.third_boat_loop "\nPlease enter the coordinates for your baby whales (1x4). Please do one coordinate at a time. They must be in a line." end |
.title ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/printer.rb', line 36 def self.title "\n" * 60 + "EEEEEEE AAA TTTTTTT TTTTTTT HH HH EEEEEEE OOOOO CCCCC EEEEEEE AAA NN NN EE AAAAA TTT TTT HH HH EE OO OO CC C EE AAAAA NNN NN EEEEE AA AA TTT TTT HHHHHHH EEEEE OO OO CC EEEEE AA AA NN N NN EE AAAAAAA TTT TTT HH HH EE OO OO CC C EE AAAAAAA NN NNN EEEEEEE AA AA TTT TTT HH HH EEEEEEE OOOO0 CCCCC EEEEEEE AA AA NN NN ".colorize(:blue) end |
.user_guess_right ⇒ Object
50 51 52 |
# File 'lib/printer.rb', line 50 def self.user_guess_right "\n" * 30 +"You scored a meal! You're closer to starving your opponent." end |
.user_guess_wrong ⇒ Object
54 55 56 |
# File 'lib/printer.rb', line 54 def self.user_guess_wrong "\n" * 30 + "You missed the catch. Too bad." end |
.user_map ⇒ Object
66 67 68 |
# File 'lib/printer.rb', line 66 def self.user_map "This is your ocean:" end |
.welcome ⇒ Object
45 46 47 48 |
# File 'lib/printer.rb', line 45 def self.welcome "\n" * 5 + "Would you like to play" + " (e)asy".colorize(:green) + " on a 4x4 grid, " + "(m)edium".colorize(:blue) + " on a 6x6 grid, or " + "(h)ard".colorize(:red) + " on an 8x8 grid? Also, read the (i)nstructions, or (q)uit?" end |
.whats_your_guess ⇒ Object
83 84 85 |
# File 'lib/printer.rb', line 83 def self.whats_your_guess "What's your guess?" end |
.you_win ⇒ Object
74 75 76 |
# File 'lib/printer.rb', line 74 def self.you_win "You have turned all the marine life in your opponent's ocean into " + "sushi".colorize(:red) + ". Congrats and bon appetit!" end |