PlayRockPaperScissorsGame 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/PlayRockPaperScissorsGame +3 -15
- data/bin/rps +3 -15
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d35182144236e0e52a8c9f81bc15e3080df98b4f
|
4
|
+
data.tar.gz: 4339cbe3ec9016a1dee1f4e9dbfdbdd51fb52c9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc6977ffb823364cad75cdceae2b74147866d5b8b73c550a05c27b63cc4f9224ae7be0d266644ba1c9395570d654ff8f0a6fbaff36c58969d76b4ee0df9e9450
|
7
|
+
data.tar.gz: 5ac7e6e4558c2f3f9ed56ec15f0f4b823f48566f5d94b30b62b09fc793b8efb9d328b5d1c78199804dfb97fa8920202dca97c2c4a3640821528ca500abb13117
|
@@ -5,24 +5,12 @@ class PlayRockPaperScissorsGame
|
|
5
5
|
class RPS
|
6
6
|
|
7
7
|
module Constants
|
8
|
-
NTRY_TO_SYM = {
|
9
|
-
'p' => :PAPER,
|
10
|
-
'r' => :ROCK,
|
11
|
-
's' => :SCISSORS
|
12
|
-
};
|
8
|
+
NTRY_TO_SYM = { 'p' => :PAPER, 'r' => :ROCK, 's' => :SCISSORS };
|
13
9
|
VALID_ENTRIES = NTRY_TO_SYM.keys;
|
14
10
|
COMPUTER_CHOICES = NTRY_TO_SYM.values;
|
15
|
-
WINNERS = [
|
16
|
-
[:SCISSORS, :PAPER],
|
17
|
-
[:PAPER, :ROCK],
|
18
|
-
[:ROCK, :SCISSORS]
|
19
|
-
]; # format: player choice, computer choice
|
11
|
+
WINNERS = [[:SCISSORS, :PAPER], [:PAPER, :ROCK], [:ROCK, :SCISSORS]]; # format: player choice, computer choice
|
20
12
|
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
|
21
|
-
INIT_STRINGS = [
|
22
|
-
"You are about to enter a rock-paper-scissors best of 3 match.",
|
23
|
-
"Press the return/enter key to continue...",
|
24
|
-
""
|
25
|
-
];
|
13
|
+
INIT_STRINGS = ["You are about to enter a rock-paper-scissors best of 3 match.", "Press the return/enter key to continue...", ""];
|
26
14
|
end;
|
27
15
|
|
28
16
|
class RockPaperScissors
|
data/bin/rps
CHANGED
@@ -5,24 +5,12 @@ class PlayRockPaperScissorsGame
|
|
5
5
|
class RPS
|
6
6
|
|
7
7
|
module Constants
|
8
|
-
NTRY_TO_SYM = {
|
9
|
-
'p' => :PAPER,
|
10
|
-
'r' => :ROCK,
|
11
|
-
's' => :SCISSORS
|
12
|
-
};
|
8
|
+
NTRY_TO_SYM = { 'p' => :PAPER, 'r' => :ROCK, 's' => :SCISSORS };
|
13
9
|
VALID_ENTRIES = NTRY_TO_SYM.keys;
|
14
10
|
COMPUTER_CHOICES = NTRY_TO_SYM.values;
|
15
|
-
WINNERS = [
|
16
|
-
[:SCISSORS, :PAPER],
|
17
|
-
[:PAPER, :ROCK],
|
18
|
-
[:ROCK, :SCISSORS]
|
19
|
-
]; # format: player choice, computer choice
|
11
|
+
WINNERS = [[:SCISSORS, :PAPER], [:PAPER, :ROCK], [:ROCK, :SCISSORS]]; # format: player choice, computer choice
|
20
12
|
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
|
21
|
-
INIT_STRINGS = [
|
22
|
-
"You are about to enter a rock-paper-scissors best of 3 match.",
|
23
|
-
"Press the return/enter key to continue...",
|
24
|
-
""
|
25
|
-
];
|
13
|
+
INIT_STRINGS = ["You are about to enter a rock-paper-scissors best of 3 match.", "Press the return/enter key to continue...", ""];
|
26
14
|
end;
|
27
15
|
|
28
16
|
class RockPaperScissors
|