PlayRockPaperScissorsGame 1.7.8 → 1.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/PlayRockPaperScissorsGame +6 -6
- data/bin/rps +6 -6
- data/lib/rps.rb +6 -6
- data/rps.gemspec +1 -1
- data/test/test_rps.rb +6 -8
- 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: 8283311fd7d212e62651972fde255b8314bd06f6
|
4
|
+
data.tar.gz: fac01879bea0d3c6a6e11b971b59d3cf6f9a9f56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5851f7cfc2b0e97b4467c65bd0ce58344ea298035a6c7432276e27561af06adb663f18b3265380bce0aa6ed46b3a20a14fe7de76c8a5d8692251056f3017b614
|
7
|
+
data.tar.gz: 60eb4048dd96a6b971545ef99828e149ffde3f99f51d8b115dc987bc7ccd06cf14870244e612d6f1543f5072bb51e5fa005a5c3ac52dbd053b855425d75546b3
|
@@ -39,12 +39,12 @@ class PlayRockPaperScissorsGame
|
|
39
39
|
end;
|
40
40
|
def play(winning_score)
|
41
41
|
while @player_score < winning_score && @computer_score < winning_score
|
42
|
-
puts ColorizedString["Player score: #{@player_score}, "].colorize(:
|
43
|
-
ColorizedString["Computer score: #{@computer_score}, Ties: #{@ties}"].colorize(:
|
42
|
+
puts ColorizedString["Player score: #{@player_score}, "].colorize(:light_blue) +
|
43
|
+
ColorizedString["Computer score: #{@computer_score}, Ties: #{@ties}"].colorize(:light_blue);
|
44
44
|
player = PrivateMethods.player_choice;
|
45
45
|
computer = Constants::COMPUTER_CHOICES.sample;
|
46
|
-
puts ColorizedString["\nPlayer chooses #{player.to_s.downcase}"].colorize(:
|
47
|
-
puts ColorizedString["Computer chooses #{computer.to_s.downcase}"].colorize(:
|
46
|
+
puts ColorizedString["\nPlayer chooses #{player.to_s.downcase}"].colorize(:light_blue);
|
47
|
+
puts ColorizedString["Computer chooses #{computer.to_s.downcase}"].colorize(:light_blue);
|
48
48
|
case PrivateMethods.player_outcome [player, computer]
|
49
49
|
when :WIN
|
50
50
|
puts ColorizedString["#{player.to_s.capitalize} beats #{computer.to_s.downcase}, player wins the round"].colorize(:red);
|
@@ -57,8 +57,8 @@ class PlayRockPaperScissorsGame
|
|
57
57
|
@ties += 1;
|
58
58
|
end;
|
59
59
|
end;
|
60
|
-
puts ColorizedString["\nFinal score: player: #{@player_score}, "].colorize(:
|
61
|
-
ColorizedString["computer: #{@computer_score} (ties: #{@ties})"].colorize(:
|
60
|
+
puts ColorizedString["\nFinal score: player: #{@player_score}, "].colorize(:light_blue) +
|
61
|
+
ColorizedString["computer: #{@computer_score} (ties: #{@ties})"].colorize(:light_blue);
|
62
62
|
case PrivateMethods.final_outcome(@player_score, @computer_score)
|
63
63
|
when :WIN
|
64
64
|
puts ColorizedString["Player wins!"].colorize(:red);
|
data/bin/rps
CHANGED
@@ -39,12 +39,12 @@ class PlayRockPaperScissorsGame
|
|
39
39
|
end;
|
40
40
|
def play(winning_score)
|
41
41
|
while @player_score < winning_score && @computer_score < winning_score
|
42
|
-
puts ColorizedString["Player score: #{@player_score}, "].colorize(:
|
43
|
-
ColorizedString["Computer score: #{@computer_score}, Ties: #{@ties}"].colorize(:
|
42
|
+
puts ColorizedString["Player score: #{@player_score}, "].colorize(:light_blue) +
|
43
|
+
ColorizedString["Computer score: #{@computer_score}, Ties: #{@ties}"].colorize(:light_blue);
|
44
44
|
player = PrivateMethods.player_choice;
|
45
45
|
computer = Constants::COMPUTER_CHOICES.sample;
|
46
|
-
puts ColorizedString["\nPlayer chooses #{player.to_s.downcase}"].colorize(:
|
47
|
-
puts ColorizedString["Computer chooses #{computer.to_s.downcase}"].colorize(:
|
46
|
+
puts ColorizedString["\nPlayer chooses #{player.to_s.downcase}"].colorize(:light_blue);
|
47
|
+
puts ColorizedString["Computer chooses #{computer.to_s.downcase}"].colorize(:light_blue);
|
48
48
|
case PrivateMethods.player_outcome [player, computer]
|
49
49
|
when :WIN
|
50
50
|
puts ColorizedString["#{player.to_s.capitalize} beats #{computer.to_s.downcase}, player wins the round"].colorize(:red);
|
@@ -57,8 +57,8 @@ class PlayRockPaperScissorsGame
|
|
57
57
|
@ties += 1;
|
58
58
|
end;
|
59
59
|
end;
|
60
|
-
puts ColorizedString["\nFinal score: player: #{@player_score}, "].colorize(:
|
61
|
-
ColorizedString["computer: #{@computer_score} (ties: #{@ties})"].colorize(:
|
60
|
+
puts ColorizedString["\nFinal score: player: #{@player_score}, "].colorize(:light_blue) +
|
61
|
+
ColorizedString["computer: #{@computer_score} (ties: #{@ties})"].colorize(:light_blue);
|
62
62
|
case PrivateMethods.final_outcome(@player_score, @computer_score)
|
63
63
|
when :WIN
|
64
64
|
puts ColorizedString["Player wins!"].colorize(:red);
|
data/lib/rps.rb
CHANGED
@@ -28,12 +28,12 @@ class PlayRockPaperScissorsGame
|
|
28
28
|
end;
|
29
29
|
def play(winning_score)
|
30
30
|
while @player_score < winning_score && @computer_score < winning_score
|
31
|
-
puts ColorizedString["Player score: #{@player_score}, "].colorize(:
|
32
|
-
ColorizedString["Computer score: #{@computer_score}, Ties: #{@ties}"].colorize(:
|
31
|
+
puts ColorizedString["Player score: #{@player_score}, "].colorize(:light_blue) +
|
32
|
+
ColorizedString["Computer score: #{@computer_score}, Ties: #{@ties}"].colorize(:light_blue);
|
33
33
|
player = PrivateMethods.player_choice;
|
34
34
|
computer = Constants::COMPUTER_CHOICES.sample;
|
35
|
-
puts ColorizedString["\nPlayer chooses #{player.to_s.downcase}"].colorize(:
|
36
|
-
puts ColorizedString["Computer chooses #{computer.to_s.downcase}"].colorize(:
|
35
|
+
puts ColorizedString["\nPlayer chooses #{player.to_s.downcase}"].colorize(:light_blue);
|
36
|
+
puts ColorizedString["Computer chooses #{computer.to_s.downcase}"].colorize(:light_blue);
|
37
37
|
case PrivateMethods.player_outcome [player, computer]
|
38
38
|
when :WIN
|
39
39
|
puts ColorizedString["#{player.to_s.capitalize} beats #{computer.to_s.downcase}, player wins the round"].colorize(:red);
|
@@ -46,8 +46,8 @@ class PlayRockPaperScissorsGame
|
|
46
46
|
@ties += 1;
|
47
47
|
end;
|
48
48
|
end;
|
49
|
-
puts ColorizedString["\nFinal score: player: #{@player_score}, "].colorize(:
|
50
|
-
ColorizedString["computer: #{@computer_score} (ties: #{@ties})"].colorize(:
|
49
|
+
puts ColorizedString["\nFinal score: player: #{@player_score}, "].colorize(:light_blue) +
|
50
|
+
ColorizedString["computer: #{@computer_score} (ties: #{@ties})"].colorize(:light_blue);
|
51
51
|
case PrivateMethods.final_outcome(@player_score, @computer_score)
|
52
52
|
when :WIN
|
53
53
|
puts ColorizedString["Player wins!"].colorize(:red);
|
data/rps.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "PlayRockPaperScissorsGame"
|
3
|
-
spec.version = "1.7.
|
3
|
+
spec.version = "1.7.9"
|
4
4
|
spec.date = "2017-04-01"
|
5
5
|
spec.summary = "A Rock Paper Scissors Ruby Gem"
|
6
6
|
spec.description = "A Ruby-programmed rock paper scissors game. To install: gem install PlayRockPaperScissorsGame; To run: rps; or: PlayRockPaperScissorsGame; For issues: https://github.com/bag3318/RockPaperScissors/issues"
|
data/test/test_rps.rb
CHANGED
@@ -21,7 +21,6 @@ class RakeTest
|
|
21
21
|
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
|
22
22
|
INIT_STRINGS = ["You are about to enter a rock-paper-scissors best of 3 match.", "Press the return/enter key to continue...", ""];
|
23
23
|
end;
|
24
|
-
|
25
24
|
class << self
|
26
25
|
def continue(str1, str2, str3)
|
27
26
|
puts ColorizedString[str1].colorize(:color => :green);
|
@@ -36,12 +35,12 @@ class RakeTest
|
|
36
35
|
end;
|
37
36
|
def testPlay(winning_score)
|
38
37
|
while @player_score < winning_score && @computer_score < winning_score
|
39
|
-
puts ColorizedString["Player score: #{@player_score}, "].colorize(:
|
40
|
-
ColorizedString["Computer score: #{@computer_score}, Ties: #{@ties}"].colorize(:
|
38
|
+
puts ColorizedString["Player score: #{@player_score}, "].colorize(:light_blue) +
|
39
|
+
ColorizedString["Computer score: #{@computer_score}, Ties: #{@ties}"].colorize(:light_blue);
|
41
40
|
player = PrivateMethods.player_choice;
|
42
41
|
computer = Constants::COMPUTER_CHOICES.sample;
|
43
|
-
puts ColorizedString["\nPlayer chooses #{player.to_s.downcase}"].colorize(:
|
44
|
-
puts ColorizedString["Computer chooses #{computer.to_s.downcase}"].colorize(:
|
42
|
+
puts ColorizedString["\nPlayer chooses #{player.to_s.downcase}"].colorize(:light_blue);
|
43
|
+
puts ColorizedString["Computer chooses #{computer.to_s.downcase}"].colorize(:light_blue);
|
45
44
|
case PrivateMethods.player_outcome [player, computer]
|
46
45
|
when :WIN
|
47
46
|
puts ColorizedString["#{player.to_s.capitalize} beats #{computer.to_s.downcase}, player wins the round"].colorize(:red);
|
@@ -54,8 +53,8 @@ class RakeTest
|
|
54
53
|
@ties += 1;
|
55
54
|
end;
|
56
55
|
end;
|
57
|
-
puts ColorizedString["\nFinal score: player: #{@player_score}, "].colorize(:
|
58
|
-
ColorizedString["computer: #{@computer_score} (ties: #{@ties})"].colorize(:
|
56
|
+
puts ColorizedString["\nFinal score: player: #{@player_score}, "].colorize(:light_blue) +
|
57
|
+
ColorizedString["computer: #{@computer_score} (ties: #{@ties})"].colorize(:light_blue);
|
59
58
|
case PrivateMethods.final_outcome(@player_score, @computer_score)
|
60
59
|
when :WIN
|
61
60
|
puts ColorizedString["Player wins!"].colorize(:red);
|
@@ -66,7 +65,6 @@ class RakeTest
|
|
66
65
|
end;
|
67
66
|
gets;
|
68
67
|
end;
|
69
|
-
private
|
70
68
|
module PrivateMethods
|
71
69
|
private;
|
72
70
|
class << self
|