rockpaperscissorsbattle 0.1.6 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e68e2683c13bc83ed9d8b0c01d6e77c7b03f8c0f
|
4
|
+
data.tar.gz: 03a1a0f03a16718a87c5a6b8e71f27c69a83d63b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af99145f64427f8c45586a5330c7a5a9a8c6a03fdcba77185959fca28cac584e9a485f0c3f63c7f5abed1d8a56cceb19b8e93dc7f9bfd3d7e7f98c0fcaeeb48f
|
7
|
+
data.tar.gz: a32449190bfa86f6f33476d3d082d7257acd24b6ddaefc7694c390f9259c02c697cf1bff6c061595b744208c8c837eafe97fb220e1dd6d423b2f76283478d2ad
|
@@ -6,10 +6,16 @@ module Rockpaperscissorsbattle
|
|
6
6
|
@player2 = args[:player2] || Computer.new
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def welcome
|
10
10
|
puts "Welcome to Rock Paper Scissors"
|
11
|
+
end
|
12
|
+
|
13
|
+
def play
|
11
14
|
puts "Get ready to Battle!"
|
15
|
+
|
16
|
+
print "Player 1:"
|
12
17
|
pick1 = @player1.pick(@options)
|
18
|
+
print "Player 2:"
|
13
19
|
pick2 = @player2.pick(@options)
|
14
20
|
compare(pick1, pick2)
|
15
21
|
end
|
@@ -23,13 +23,19 @@ module Rockpaperscissorsbattle
|
|
23
23
|
|
24
24
|
def track_winners(winner)
|
25
25
|
@score[winner] += 1
|
26
|
-
|
26
|
+
puts "Player 1 score: #{@score[1]}"
|
27
|
+
puts "Player 2 score: #{@score[2]}"
|
28
|
+
puts "Ties: #{@score[0]}"
|
27
29
|
end
|
28
30
|
|
29
31
|
def reset
|
30
32
|
puts "Would you like to play again? (Y/N)"
|
31
33
|
choice = gets.strip.downcase
|
32
|
-
|
34
|
+
if choice == "y"
|
35
|
+
start
|
36
|
+
else
|
37
|
+
puts "Thanks for playing!"
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
41
|
|