RPSrb 0.1.3 → 0.1.4
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 +4 -4
- data/RPSrb.gemspec +1 -1
- data/doc/RockPaperScissors.html +7 -9
- data/doc/created.rid +3 -3
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js.gz +0 -0
- data/lib/RPSrb/Version.rb +1 -1
- data/lib/RockPaperScissors.rb +3 -2
- 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: ab0dd25a221e442d04cf82e9e6dc3f1144628865
|
4
|
+
data.tar.gz: ac743357ec71511950e5fdc80d82a9d59dadab8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cf4985ffa4f1e70820faed867ea60c8c03aadc0b6ae7f81682c2b746a4fdec67de976b63362da10dee339df41a92603ba354f2cefc0b29845ae29071f1bbf01
|
7
|
+
data.tar.gz: 47fe31ed11516ce261ac885ba6d064543d94184f49c3a3d8dda83e20f854ce84ebeccece902cc883003394f558a92cbb6b3c94e6a6659ef70d7c2c0266c398d4
|
data/RPSrb.gemspec
CHANGED
data/doc/RockPaperScissors.html
CHANGED
@@ -181,15 +181,13 @@
|
|
181
181
|
|
182
182
|
<div class="method-description">
|
183
183
|
|
184
|
-
|
185
|
-
|
186
|
-
<p>this will provide a game intro</p>
|
184
|
+
|
187
185
|
|
188
186
|
|
189
187
|
|
190
188
|
|
191
189
|
<div class="method-source-code" id="continue-source">
|
192
|
-
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line
|
190
|
+
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line 42</span>
|
193
191
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">continue</span>(<span class="ruby-identifier">str1</span>,<span class="ruby-identifier">str2</span>,<span class="ruby-identifier">str3</span>)
|
194
192
|
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">str1</span>
|
195
193
|
<span class="ruby-identifier">print</span> <span class="ruby-identifier">str2</span>
|
@@ -225,7 +223,7 @@
|
|
225
223
|
|
226
224
|
|
227
225
|
<div class="method-source-code" id="new-source">
|
228
|
-
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line
|
226
|
+
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line 53</span>
|
229
227
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
|
230
228
|
<span class="ruby-ivar">@player_score</span> = <span class="ruby-ivar">@computer_score</span> = <span class="ruby-ivar">@ties</span> = <span class="ruby-value">0</span>
|
231
229
|
<span class="ruby-keyword">end</span></pre>
|
@@ -268,7 +266,7 @@
|
|
268
266
|
|
269
267
|
|
270
268
|
<div class="method-source-code" id="final_outcome-source">
|
271
|
-
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line
|
269
|
+
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line 117</span>
|
272
270
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">final_outcome</span>(<span class="ruby-identifier">pl</span>, <span class="ruby-identifier">co</span>)
|
273
271
|
<span class="ruby-keyword">return</span> <span class="ruby-value">:WIN</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">pl</span> <span class="ruby-operator">></span> <span class="ruby-identifier">co</span>
|
274
272
|
<span class="ruby-keyword">return</span> <span class="ruby-value">:LOSE</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">pl</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">co</span>
|
@@ -304,7 +302,7 @@
|
|
304
302
|
|
305
303
|
|
306
304
|
<div class="method-source-code" id="play-source">
|
307
|
-
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line
|
305
|
+
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line 59</span>
|
308
306
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">play</span>(<span class="ruby-identifier">winning_score</span>)
|
309
307
|
<span class="ruby-keyword">while</span> <span class="ruby-ivar">@player_score</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">winning_score</span> <span class="ruby-operator">&&</span> <span class="ruby-ivar">@computer_score</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">winning_score</span>
|
310
308
|
<span class="ruby-identifier">puts</span> <span class="ruby-node">"\nPlayer score: #{@player_score}, "</span> <span class="ruby-operator">+</span>
|
@@ -367,7 +365,7 @@
|
|
367
365
|
|
368
366
|
|
369
367
|
<div class="method-source-code" id="player_choice-source">
|
370
|
-
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line
|
368
|
+
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line 93</span>
|
371
369
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">player_choice</span>
|
372
370
|
<span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
|
373
371
|
<span class="ruby-identifier">print</span> <span class="ruby-string">"\nChoose: Rock (r), Paper (p), or Scissors (s): "</span>
|
@@ -412,7 +410,7 @@
|
|
412
410
|
|
413
411
|
|
414
412
|
<div class="method-source-code" id="player_outcome-source">
|
415
|
-
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line
|
413
|
+
<pre><span class="ruby-comment"># File lib/RockPaperScissors.rb, line 109</span>
|
416
414
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">player_outcome</span>(<span class="ruby-identifier">plays</span>)
|
417
415
|
<span class="ruby-keyword">return</span> <span class="ruby-value">:WIN</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">WINNERS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">plays</span>)
|
418
416
|
<span class="ruby-keyword">return</span> <span class="ruby-value">:LOSE</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">LOSERS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">plays</span>)
|
data/doc/created.rid
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Tue, 12 Dec 2017 11:
|
1
|
+
Tue, 12 Dec 2017 11:25:42 -0800
|
2
2
|
lib/exec.rb Tue, 12 Dec 2017 09:59:08 -0800
|
3
|
-
lib/RockPaperScissors.rb Tue, 12 Dec 2017 11:
|
4
|
-
lib/RPSrb/Version.rb Tue, 12 Dec 2017
|
3
|
+
lib/RockPaperScissors.rb Tue, 12 Dec 2017 11:25:10 -0800
|
4
|
+
lib/RPSrb/Version.rb Tue, 12 Dec 2017 11:25:18 -0800
|
data/doc/js/navigation.js.gz
CHANGED
Binary file
|
data/doc/js/search_index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["rpsrb","rockpaperscissors","continue()","final_outcome()","new()","play()","player_choice()","player_outcome()"],"longSearchIndex":["rpsrb","rockpaperscissors","rockpaperscissors::continue()","rockpaperscissors#final_outcome()","rockpaperscissors::new()","rockpaperscissors#play()","rockpaperscissors#player_choice()","rockpaperscissors#player_outcome()"],"info":[["RPSrb","","RPSrb.html","","<p>RubyGems version constant\n<p>this is required for all rubygem packages\n"],["RockPaperScissors","","RockPaperScissors.html","",""],["continue","RockPaperScissors","RockPaperScissors.html#method-c-continue","(str1,str2,str3)","
|
1
|
+
var search_data = {"index":{"searchIndex":["rpsrb","rockpaperscissors","continue()","final_outcome()","new()","play()","player_choice()","player_outcome()"],"longSearchIndex":["rpsrb","rockpaperscissors","rockpaperscissors::continue()","rockpaperscissors#final_outcome()","rockpaperscissors::new()","rockpaperscissors#play()","rockpaperscissors#player_choice()","rockpaperscissors#player_outcome()"],"info":[["RPSrb","","RPSrb.html","","<p>RubyGems version constant\n<p>this is required for all rubygem packages\n"],["RockPaperScissors","","RockPaperScissors.html","",""],["continue","RockPaperScissors","RockPaperScissors.html#method-c-continue","(str1,str2,str3)",""],["final_outcome","RockPaperScissors","RockPaperScissors.html#method-i-final_outcome","(pl, co)","<p>Define final outcome function\n<p>this will determine who wins the whole match in the end\n"],["new","RockPaperScissors","RockPaperScissors.html#method-c-new","()","<p>Define constructor for class\n"],["play","RockPaperScissors","RockPaperScissors.html#method-i-play","(winning_score)","<p>Define play game method\n<p>it will also constain most of the “play” functioonality for this game …\n"],["player_choice","RockPaperScissors","RockPaperScissors.html#method-i-player_choice","()","<p>Make player choice method\n<p>this will sanity check the user's choice\n"],["player_outcome","RockPaperScissors","RockPaperScissors.html#method-i-player_outcome","(plays)","<p>Define player outcome\n<p>this defines the round outcome of the game\n"]]}}
|
data/doc/js/search_index.js.gz
CHANGED
Binary file
|
data/doc/js/searcher.js.gz
CHANGED
Binary file
|
data/lib/RPSrb/Version.rb
CHANGED
data/lib/RockPaperScissors.rb
CHANGED
@@ -35,9 +35,10 @@ class RockPaperScissors
|
|
35
35
|
# this flips the items in the `WINNERS` 2d array
|
36
36
|
LOSERS = WINNERS.map { |winning_choice,losing_choice| [losing_choice,winning_choice] }
|
37
37
|
|
38
|
+
|
39
|
+
# == Define entry point for game
|
40
|
+
# this will provide a game intro
|
38
41
|
class << self
|
39
|
-
# == Define entry point for game
|
40
|
-
# this will provide a game intro
|
41
42
|
def continue(str1,str2,str3)
|
42
43
|
puts str1
|
43
44
|
print str2
|