bin/rps in PlayRockPaperScissorsGame-1.7.4 vs bin/rps in PlayRockPaperScissorsGame-1.7.5
- old
+ new
@@ -14,10 +14,11 @@
require "colorized_string";
ColorizedString.colors;
ColorizedString.modes;
module Constants
+ protected;
NTRY_TO_SYM = { 'p' => :PAPER, 'r' => :ROCK, 's' => :SCISSORS };
VALID_ENTRIES = NTRY_TO_SYM.keys;
COMPUTER_CHOICES = NTRY_TO_SYM.values;
WINNERS = [[:SCISSORS, :PAPER], [:PAPER, :ROCK], [:ROCK, :SCISSORS]]; # format: player choice, computer choice
LOSERS = WINNERS.map { |i,j| [j,i] }; # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
@@ -67,9 +68,10 @@
puts ColorizedString["It's a tie!"].colorize(:red);
end;
gets;
end;
module PrivateMethods
+ private;
class << self
def player_choice
loop do
print ColorizedString["Choose rock (r), paper (p) or scissors (s): "].colorize(:green);
choice = gets.chomp.downcase;