rpsg 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -7
  3. data/Rakefile +8 -0
  4. data/bin/rpsg +8 -10
  5. data/html/Constants.html +138 -0
  6. data/html/PrivateMethods.html +241 -0
  7. data/html/README_md.html +139 -0
  8. data/html/RPSG.html +112 -0
  9. data/html/RockPapaerScissorsGame.html +268 -0
  10. data/html/created.rid +7 -0
  11. data/html/css/fonts.css +167 -0
  12. data/html/css/rdoc.css +590 -0
  13. data/html/fonts/Lato-Light.ttf +0 -0
  14. data/html/fonts/Lato-LightItalic.ttf +0 -0
  15. data/html/fonts/Lato-Regular.ttf +0 -0
  16. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  17. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  18. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  19. data/html/images/add.png +0 -0
  20. data/html/images/arrow_up.png +0 -0
  21. data/html/images/brick.png +0 -0
  22. data/html/images/brick_link.png +0 -0
  23. data/html/images/bug.png +0 -0
  24. data/html/images/bullet_black.png +0 -0
  25. data/html/images/bullet_toggle_minus.png +0 -0
  26. data/html/images/bullet_toggle_plus.png +0 -0
  27. data/html/images/date.png +0 -0
  28. data/html/images/delete.png +0 -0
  29. data/html/images/find.png +0 -0
  30. data/html/images/loadingAnimation.gif +0 -0
  31. data/html/images/macFFBgHack.png +0 -0
  32. data/html/images/package.png +0 -0
  33. data/html/images/page_green.png +0 -0
  34. data/html/images/page_white_text.png +0 -0
  35. data/html/images/page_white_width.png +0 -0
  36. data/html/images/plugin.png +0 -0
  37. data/html/images/ruby.png +0 -0
  38. data/html/images/tag_blue.png +0 -0
  39. data/html/images/tag_green.png +0 -0
  40. data/html/images/transparent.png +0 -0
  41. data/html/images/wrench.png +0 -0
  42. data/html/images/wrench_orange.png +0 -0
  43. data/html/images/zoom.png +0 -0
  44. data/html/index.html +96 -0
  45. data/html/js/darkfish.js +161 -0
  46. data/html/js/jquery.js +4 -0
  47. data/html/js/navigation.js +142 -0
  48. data/html/js/navigation.js.gz +0 -0
  49. data/html/js/search.js +109 -0
  50. data/html/js/search_index.js +1 -0
  51. data/html/js/search_index.js.gz +0 -0
  52. data/html/js/searcher.js +229 -0
  53. data/html/js/searcher.js.gz +0 -0
  54. data/html/table_of_contents.html +101 -0
  55. data/lib/Constants.rb +19 -11
  56. data/lib/PrivateMethods.rb +4 -0
  57. data/lib/rpsg/version.rb +3 -1
  58. data/rpsg.gemspec +1 -1
  59. data/test/rpsg.rb +1 -0
  60. metadata +51 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 71f6aa7a91b90c6293daf8dc59a57f63245405c6
4
- data.tar.gz: 133047f8a2c36dc902a601f0d80b07127283de74
3
+ metadata.gz: ab6cb9b4d77ea3fa7f8096a9071fa605b180205d
4
+ data.tar.gz: 63e8524b9a007ce8eae364cecb65628ef29ba4e6
5
5
  SHA512:
6
- metadata.gz: 3d12e1035eda110b24d02623f060ddf11427b8366d372710e258299d09174067108bba4b0d940bc629b4295280b110a93cdff1af84d35ae4aa320b4dd12235b6
7
- data.tar.gz: 782b40cd093e9a5e0816e9ea77bd93a7d3a907a27017d81ddb8f55dd41062659f2e5c7856ba5a17e4844ae410b0537376e07b7b0f0d84d45d7b26157d9661ac2
6
+ metadata.gz: 4bd4ba94dfb5106368a31bea8f2bb4aab131cae4ffc4c0930a0feacb1394ea994009834a639d7c85a471b6c5b939383be18fe2e6228abe2be6cea1bd6c2e81ae
7
+ data.tar.gz: c947849757d82c53311f603bfde43ea1e5689c1134ef71a5620ccbcbc06b695d6b8a3c55b991378eff1e6613a7a0b757b6940db667f11b34e9db59c6c10d8e7f
data/Gemfile CHANGED
@@ -1,11 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
  platform :ruby do
3
3
  gemspec
4
- # group :test do
5
- # gem 'bundler' , '~> 1.14.6' , :require => true
6
- # gem 'colorize', '~> 0.8.1' , :require => true
7
- # gem 'rake' , '~> 12.0.0' , :require => true
8
- # gem 'rdoc' , '~> 5.1.0' , :require => true
9
- # gem 'rvm' , '~> 1.11.3.9', :require => true
10
- # end
11
4
  end
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ require 'rdoc/task'
2
+
1
3
  task :default => :test
2
4
 
3
5
  file_path = "./test/rpsg.rb"
@@ -5,3 +7,9 @@ file_path = "./test/rpsg.rb"
5
7
  task :test do
6
8
  ruby file_path
7
9
  end
10
+
11
+
12
+ RDoc::Task.new do |rdoc|
13
+ # rdoc.main = "README.rdoc"
14
+ rdoc.rdoc_files.include("README.md", "lib", "bin", "test/rpsg.rb")
15
+ end
data/bin/rpsg CHANGED
@@ -1,12 +1,4 @@
1
- #!/usr/bin/env ruby
2
-
3
- =begin
4
- |====================================|
5
- | Req Ruby Ver | Req Ruby Gems Ver |
6
- |--------------|---------------------|
7
- | >= v2.0.0 | >= v2.6.0 |
8
- |====================================|
9
- =end
1
+ #!/usr/bin/env rubyn
10
2
 
11
3
  class RockPapaerScissorsGame
12
4
 
@@ -21,6 +13,7 @@ class RockPapaerScissorsGame
21
13
  protected_methods :Constants
22
14
 
23
15
  class << self
16
+ # add continue method for asking the user if they want to play rock paper scissors
24
17
  def continue(str1,str2,str3)
25
18
  puts str1
26
19
  print str2
@@ -29,13 +22,18 @@ class RockPapaerScissorsGame
29
22
  end
30
23
  end
31
24
 
32
- continue(Constants::INIT_STRINGS[0], Constants::INIT_STRINGS[1], Constants::INIT_STRINGS[2])
25
+ # print out strings
26
+ continue("You are about to enter a rock-paper-scissors best of 3 match.", "Press the return/enter key to continue...", "")
33
27
 
28
+ # initialize variables
34
29
  def initialize
30
+ # set all equal to zero
35
31
  @player_score = @computer_score = @ties = 0
36
32
  end
37
33
 
34
+ # define play method, this will be the main function for playing rock paper scissors
38
35
  def play(winning_score)
36
+ # make while loop
39
37
  while @player_score < winning_score && @computer_score < winning_score
40
38
  puts "Player score: #{@player_score}, " +
41
39
  "Computer score: #{@computer_score}, Ties: #{@ties}.\n"
@@ -0,0 +1,138 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module Constants - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/jquery.js"></script>
15
+ <script src="./js/darkfish.js"></script>
16
+
17
+ <link href="./css/fonts.css" rel="stylesheet">
18
+ <link href="./css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="module">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="./index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="./table_of_contents.html#pages">Pages</a>
32
+ <a href="./table_of_contents.html#classes">Classes</a>
33
+ <a href="./table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+
59
+
60
+
61
+
62
+ </div>
63
+ </nav>
64
+
65
+ <main role="main" aria-labelledby="module-Constants">
66
+ <h1 id="module-Constants" class="module">
67
+ module Constants
68
+ </h1>
69
+
70
+ <section class="description">
71
+
72
+ <p>create module that holds all contents for this script</p>
73
+
74
+ </section>
75
+
76
+
77
+
78
+
79
+ <section id="5Buntitled-5D" class="documentation-section">
80
+
81
+
82
+
83
+
84
+
85
+ <section class="constants-list">
86
+ <header>
87
+ <h3>Constants</h3>
88
+ </header>
89
+ <dl>
90
+
91
+ <dt id="CHOICES">CHOICES
92
+
93
+ <dd><p>create 2d list of choices</p>
94
+
95
+
96
+ <dt id="COMPUTER_CHOICES">COMPUTER_CHOICES
97
+
98
+ <dd><p>define computer choices</p>
99
+
100
+
101
+ <dt id="LOSERS">LOSERS
102
+
103
+ <dd><p>this will take the original <a href="Constants.html#WINNERS">WINNERS</a>
104
+ array and flip the symbols, thus returning a loss for the user/player</p>
105
+
106
+
107
+ <dt id="NTRY_TO_SYM">NTRY_TO_SYM
108
+
109
+ <dd><p>define entry to symbol (key to value)</p>
110
+
111
+
112
+ <dt id="VALID_ENTRIES">VALID_ENTRIES
113
+
114
+ <dd><p>define valid entries</p>
115
+
116
+
117
+ <dt id="WINNERS">WINNERS
118
+
119
+ <dd><p>create winners 2d list array with format: winning choice, losing choice</p>
120
+
121
+
122
+ </dl>
123
+ </section>
124
+
125
+
126
+
127
+
128
+
129
+ </section>
130
+ </main>
131
+
132
+
133
+ <footer id="validator-badges" role="contentinfo">
134
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
135
+ <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.0.0.
136
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
137
+ </footer>
138
+
@@ -0,0 +1,241 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta charset="UTF-8">
6
+
7
+ <title>module PrivateMethods - RDoc Documentation</title>
8
+
9
+ <script type="text/javascript">
10
+ var rdoc_rel_prefix = "./";
11
+ var index_rel_prefix = "./";
12
+ </script>
13
+
14
+ <script src="./js/jquery.js"></script>
15
+ <script src="./js/darkfish.js"></script>
16
+
17
+ <link href="./css/fonts.css" rel="stylesheet">
18
+ <link href="./css/rdoc.css" rel="stylesheet">
19
+
20
+
21
+
22
+ <body id="top" role="document" class="module">
23
+ <nav role="navigation">
24
+ <div id="project-navigation">
25
+ <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
+ <h2>
27
+ <a href="./index.html" rel="home">Home</a>
28
+ </h2>
29
+
30
+ <div id="table-of-contents-navigation">
31
+ <a href="./table_of_contents.html#pages">Pages</a>
32
+ <a href="./table_of_contents.html#classes">Classes</a>
33
+ <a href="./table_of_contents.html#methods">Methods</a>
34
+ </div>
35
+ </div>
36
+
37
+ <div id="search-section" role="search" class="project-section initially-hidden">
38
+ <form action="#" method="get" accept-charset="utf-8">
39
+ <div id="search-field-wrapper">
40
+ <input id="search-field" role="combobox" aria-label="Search"
41
+ aria-autocomplete="list" aria-controls="search-results"
42
+ type="text" name="search" placeholder="Search" spellcheck="false"
43
+ title="Type to search, Up and Down to navigate, Enter to load">
44
+ </div>
45
+
46
+ <ul id="search-results" aria-label="Search Results"
47
+ aria-busy="false" aria-expanded="false"
48
+ aria-atomic="false" class="initially-hidden"></ul>
49
+ </form>
50
+ </div>
51
+
52
+ </div>
53
+
54
+
55
+
56
+ <div id="class-metadata">
57
+
58
+
59
+
60
+
61
+ <!-- Method Quickref -->
62
+ <div id="method-list-section" class="nav-section">
63
+ <h3>Methods</h3>
64
+
65
+ <ul class="link-list" role="directory">
66
+
67
+ <li ><a href="#method-c-final_outcome">::final_outcome</a>
68
+
69
+ <li ><a href="#method-c-player_choice">::player_choice</a>
70
+
71
+ <li ><a href="#method-c-player_outcome">::player_outcome</a>
72
+
73
+ </ul>
74
+ </div>
75
+
76
+ </div>
77
+ </nav>
78
+
79
+ <main role="main" aria-labelledby="module-PrivateMethods">
80
+ <h1 id="module-PrivateMethods" class="module">
81
+ module PrivateMethods
82
+ </h1>
83
+
84
+ <section class="description">
85
+
86
+ <p>add module for private methods for the rpsg calculations</p>
87
+
88
+ </section>
89
+
90
+
91
+
92
+
93
+ <section id="5Buntitled-5D" class="documentation-section">
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section">
104
+ <header>
105
+ <h3>Public Class Methods</h3>
106
+ </header>
107
+
108
+
109
+ <div id="method-c-final_outcome" class="method-detail ">
110
+
111
+ <div class="method-heading">
112
+ <span class="method-name">final_outcome</span><span
113
+ class="method-args">(pl,co)</span>
114
+
115
+ <span class="method-click-advice">click to toggle source</span>
116
+
117
+ </div>
118
+
119
+
120
+ <div class="method-description">
121
+
122
+ <p>define final outcome that gives the result of who one the whole match</p>
123
+
124
+
125
+
126
+
127
+ <div class="method-source-code" id="final_outcome-source">
128
+ <pre><span class="ruby-comment"># File lib/PrivateMethods.rb, line 32</span>
129
+ <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>)
130
+ <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">&gt;</span> <span class="ruby-identifier">co</span>
131
+ <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">&lt;</span> <span class="ruby-identifier">co</span>
132
+ <span class="ruby-keyword">return</span> <span class="ruby-value">:TIE</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">pl</span> = <span class="ruby-identifier">co</span>
133
+ <span class="ruby-comment"># there will never be a tie for the final outcome due to the code in the play() method</span>
134
+ <span class="ruby-keyword">end</span></pre>
135
+ </div>
136
+
137
+ </div>
138
+
139
+
140
+
141
+
142
+ </div>
143
+
144
+
145
+ <div id="method-c-player_choice" class="method-detail ">
146
+
147
+ <div class="method-heading">
148
+ <span class="method-name">player_choice</span><span
149
+ class="method-args">()</span>
150
+
151
+ <span class="method-click-advice">click to toggle source</span>
152
+
153
+ </div>
154
+
155
+
156
+ <div class="method-description">
157
+
158
+ <p>make a definition that asks for the players choice</p>
159
+
160
+
161
+
162
+
163
+ <div class="method-source-code" id="player_choice-source">
164
+ <pre><span class="ruby-comment"># File lib/PrivateMethods.rb, line 5</span>
165
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">player_choice</span>
166
+ <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
167
+ <span class="ruby-identifier">print</span> <span class="ruby-string">&quot;\nChoose: Rock (r), Paper (p), or Scissors (s): \n&quot;</span>
168
+ <span class="ruby-identifier">choice</span> = <span class="ruby-identifier">gets</span>.<span class="ruby-identifier">chomp</span>.<span class="ruby-identifier">downcase</span>
169
+ <span class="ruby-keyword">if</span> <span class="ruby-constant">Constants</span><span class="ruby-operator">::</span><span class="ruby-constant">NTRY_TO_SYM</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">choice</span>)
170
+ <span class="ruby-keyword">return</span> <span class="ruby-constant">Constants</span><span class="ruby-operator">::</span><span class="ruby-constant">NTRY_TO_SYM</span>[<span class="ruby-identifier">choice</span>]
171
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">choice</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Constants</span><span class="ruby-operator">::</span><span class="ruby-constant">VALID_ENTRIES</span>
172
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;\nThat entry is invalid. Please re-enter.\n&quot;</span>
173
+ <span class="ruby-keyword">else</span>
174
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
175
+ <span class="ruby-keyword">end</span>
176
+ <span class="ruby-comment"># # one may also do this:</span>
177
+ <span class="ruby-comment"># case</span>
178
+ <span class="ruby-comment"># when Constants::NTRY_TO_SYM.key?(choice)</span>
179
+ <span class="ruby-comment"># return Constants::NTRY_TO_SYM[choice]</span>
180
+ <span class="ruby-comment"># when choice != Constants::VALID_ENTRIES</span>
181
+ <span class="ruby-comment"># puts &quot;That entry is invalid. Please re-enter.&quot; </span>
182
+ <span class="ruby-comment"># end</span>
183
+ <span class="ruby-keyword">end</span>
184
+ <span class="ruby-keyword">end</span></pre>
185
+ </div>
186
+
187
+ </div>
188
+
189
+
190
+
191
+
192
+ </div>
193
+
194
+
195
+ <div id="method-c-player_outcome" class="method-detail ">
196
+
197
+ <div class="method-heading">
198
+ <span class="method-name">player_outcome</span><span
199
+ class="method-args">(plays)</span>
200
+
201
+ <span class="method-click-advice">click to toggle source</span>
202
+
203
+ </div>
204
+
205
+
206
+ <div class="method-description">
207
+
208
+ <p>define outcomes of players choice against cpu</p>
209
+
210
+
211
+
212
+
213
+ <div class="method-source-code" id="player_outcome-source">
214
+ <pre><span class="ruby-comment"># File lib/PrivateMethods.rb, line 26</span>
215
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">player_outcome</span>(<span class="ruby-identifier">plays</span>)
216
+ <span class="ruby-keyword">return</span> <span class="ruby-value">:WIN</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Constants</span><span class="ruby-operator">::</span><span class="ruby-constant">WINNERS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">plays</span>)
217
+ <span class="ruby-keyword">return</span> <span class="ruby-value">:LOSE</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Constants</span><span class="ruby-operator">::</span><span class="ruby-constant">LOSERS</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">plays</span>)
218
+ <span class="ruby-keyword">return</span> <span class="ruby-value">:TIE</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-value">:WIN</span> <span class="ruby-operator">|</span> <span class="ruby-operator">!</span><span class="ruby-value">:LOSE</span>
219
+ <span class="ruby-keyword">end</span></pre>
220
+ </div>
221
+
222
+ </div>
223
+
224
+
225
+
226
+
227
+ </div>
228
+
229
+
230
+ </section>
231
+
232
+ </section>
233
+ </main>
234
+
235
+
236
+ <footer id="validator-badges" role="contentinfo">
237
+ <p><a href="http://validator.w3.org/check/referer">Validate</a>
238
+ <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.0.0.
239
+ <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
240
+ </footer>
241
+