PlayRockPaperScissorsGame 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rps.rb +2 -43
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9db044524cb124a7fd53158d1bf20e7866c42316
4
- data.tar.gz: 91321afc7fd480638533328e5526d088a31fd516
3
+ metadata.gz: dcbed2914ae83f83bf3ff3df9d329cd3f8b85912
4
+ data.tar.gz: 5ff38e5a8aeee5e52e76e39ddcda1bc28955eba4
5
5
  SHA512:
6
- metadata.gz: c67c94a23a365c30b4f19b56f53c92e49e81bc09ffdc24728dda90291113de90cd6cf550f213a88dd2fce4dfb65ce9d459f34e5f4ee6e53828b1798bfe28d365
7
- data.tar.gz: 6c91a7ad1e636aab8fde40f199b3d38d1f12b69762615b022c2645bad54914c1df3607b983b743b7df6821d586ca7a0bd77679eb4a648c71a28df1be3ccc2a42
6
+ metadata.gz: 435fd7b3f237a9db0728df53b60d0805c7f8ff98408e54e090138f7054053f6a2d6fc76afc02bbac6d0b70a6faf2c2e6c14fb4cef83ac9e264a97f06f8b7b08c
7
+ data.tar.gz: 85fea18fea7e5036e20cc22b052d2ad39929d673f1f9215bc1983864c89654cad7ab7a85f82ccb88bd6594f42f9e2f8e72bda4753e7d5959386fffca5f8fca74
data/lib/rps.rb CHANGED
@@ -2,26 +2,7 @@ class PlayRockPaperScissorsGame
2
2
 
3
3
  class RPS
4
4
 
5
- module Constants
6
- NTRY_TO_SYM = {
7
- 'p' => :PAPER,
8
- 'r' => :ROCK,
9
- 's' => :SCISSORS
10
- };
11
- VALID_ENTRIES = NTRY_TO_SYM.keys;
12
- COMPUTER_CHOICES = NTRY_TO_SYM.values;
13
- WINNERS = [
14
- [:SCISSORS, :PAPER],
15
- [:PAPER, :ROCK],
16
- [:ROCK, :SCISSORS]
17
- ]; # format: player choice, computer choice
18
- 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
19
- INIT_STRINGS = [
20
- "You are about to enter a rock-paper-scissors best of 3 match.",
21
- "Press the return/enter key to continue...",
22
- ""
23
- ];
24
- end;
5
+ require "ref/Constants.rb";
25
6
 
26
7
  class RockPaperScissors
27
8
  class << self
@@ -69,29 +50,7 @@ class PlayRockPaperScissorsGame
69
50
  puts "";
70
51
  gets;
71
52
  end;
72
- private
73
- module PrivateVars
74
- class << self
75
- def player_choice
76
- loop do
77
- print "Choose rock (r), paper (p) or scissors (s): ";
78
- choice = gets.chomp.downcase;
79
- return Constants::NTRY_TO_SYM[choice] if Constants::NTRY_TO_SYM.key?(choice);
80
- puts "That entry is invalid. Please re-enter";
81
- end;
82
- end;
83
- def player_outcome(plays)
84
- return :WIN if Constants::WINNERS.include?(plays);
85
- return :LOSE if Constants::LOSERS.include?(plays);
86
- return :TIE if !:WIN | !:LOSE;
87
- end;
88
- def final_outcome(pl, co)
89
- return :WIN if pl > co;
90
- return :LOSE if pl < co;
91
- return :TIE if pl = co;
92
- end;
93
- end;
94
- end;
53
+ require "ref/PrivateVars.rb";
95
54
  end;
96
55
  end;
97
56
  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.1.7
4
+ version: 1.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - bag3318