PlayRockPaperScissorsGame 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ebb9131b4259511cad96cc8599eaf4f747a090d
4
- data.tar.gz: 171ae16a2ea019e1e64ee7a52f8ecc4d0f5e01ae
3
+ metadata.gz: d3b9edbcb6a87123e1e532b3dd15c82f5074354b
4
+ data.tar.gz: 5f924307d6ab9a932ef1c701f60c9a222b96b3b4
5
5
  SHA512:
6
- metadata.gz: c58982dfb60a7246af75c0397873574e577fdf3b7a414713ee4694608060e0b5d60fe349ecac5c207e2c40d22cb20e3b85073339a6455e9526c79d2356bce3b7
7
- data.tar.gz: 1372ec2f9b4497685596f3b508d1ad30a970ad1408ddf14d497a3feb7d3c0ece84cdfeeaca0de3f18f61ea245cc4f141e1fcfa97d1425110ef59205f83a62adf
6
+ metadata.gz: 441c7b47b99e74d7a04dad9b3a84b72849cee179f2c2d1b53bc2e7856a412a76cbdbd9326925a73593b3fc16d870820513ee5d55c7c710bc9e50664b772f75c1
7
+ data.tar.gz: e7c7b195d45979090677cd08b9764040f13ee0bf100a6a96bf30465dec4c879b7894b833e91d460776bc73570885f97712d566b8a7816c85d48ec6349f271c91
@@ -0,0 +1,20 @@
1
+ module Constants
2
+ NTRY_TO_SYM = {
3
+ 'p' => :PAPER,
4
+ 'r' => :ROCK,
5
+ 's' => :SCISSORS
6
+ };
7
+ VALID_ENTRIES = NTRY_TO_SYM.keys;
8
+ COMPUTER_CHOICES = NTRY_TO_SYM.values;
9
+ WINNERS = [
10
+ [:SCISSORS, :PAPER],
11
+ [:PAPER, :ROCK],
12
+ [:ROCK, :SCISSORS]
13
+ ]; # format: player choice, computer choice
14
+ 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
15
+ INIT_STRINGS = [
16
+ "You are about to enter a rock-paper-scissors best of 3 match.",
17
+ "Press the return/enter key to continue...",
18
+ ""
19
+ ];
20
+ end;
@@ -0,0 +1,23 @@
1
+ private
2
+ module PrivateVars
3
+ class << self
4
+ def player_choice
5
+ loop do
6
+ print "Choose rock (r), paper (p) or scissors (s): ";
7
+ choice = gets.chomp.downcase;
8
+ return Constants::NTRY_TO_SYM[choice] if Constants::NTRY_TO_SYM.key?(choice);
9
+ puts "That entry is invalid. Please re-enter";
10
+ end;
11
+ end;
12
+ def player_outcome(plays)
13
+ return :WIN if Constants::WINNERS.include?(plays);
14
+ return :LOSE if Constants::LOSERS.include?(plays);
15
+ return :TIE if !:WIN | !:LOSE;
16
+ end;
17
+ def final_outcome(pl, co)
18
+ return :WIN if pl > co;
19
+ return :LOSE if pl < co;
20
+ return :TIE if pl = co;
21
+ end;
22
+ end;
23
+ end;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PlayRockPaperScissorsGame
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7
4
+ version: 1.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - bag3318
@@ -64,6 +64,8 @@ files:
64
64
  - README.md
65
65
  - bin/PlayRockPaperScissorsGame
66
66
  - bin/rps
67
+ - lib/ref/Constants.rb
68
+ - lib/ref/PrivateVars.rb
67
69
  - lib/rps.rb
68
70
  homepage: https://rubygems.org/gems/PlayRockPaperScissorsGame/
69
71
  licenses: