Sha256: dba7141b156c85bd9808e6f427b2d83f5238d32718e722270bc0190dd0aa53b9

Contents?: true

Size: 819 Bytes

Versions: 48

Compression:

Stored size: 819 Bytes

Contents

require "colorized_string"
ColorizedString.colors   
ColorizedString.modes  
module Constants 
  NTRY_TO_SYM = { 
    'p' => :PAPER, 
    'r' => :ROCK, 
    's' => :SCISSORS 
  } 
  VALID_ENTRIES = NTRY_TO_SYM.keys # create valid entries
  COMPUTER_CHOICES = NTRY_TO_SYM.values # define computer choices
  WINNERS = [
    # format: player choice, computer choice
    [:SCISSORS, :PAPER], 
    [:PAPER   , :ROCK], 
    [:ROCK    , :SCISSORS]
  ] 
  LOSERS = WINNERS.map { |pc,cc| [cc,pc] } # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
  INIT_STRINGS = [
    ColorizedString["You are about to enter a rock-paper-scissors best of 3 match."].colorize(:green), 
    ColorizedString["Press the return/enter key to continue..."].colorize(:green), 
    ""
  ]
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
PlayRockPaperScissorsGame-2.4.9 lib/Constants.rb
PlayRockPaperScissorsGame-2.4.8 lib/Constants.rb
PlayRockPaperScissorsGame-2.4.7 lib/Constants.rb
PlayRockPaperScissorsGame-2.4.6 lib/Constants.rb
PlayRockPaperScissorsGame-2.4.5 lib/Constants.rb
PlayRockPaperScissorsGame-2.4.4 lib/Constants.rb
PlayRockPaperScissorsGame-2.4.3 lib/Constants.rb
PlayRockPaperScissorsGame-2.4.2 lib/Constants.rb