rpsg 0.3.2 → 0.3.3

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: 54c3079280cba76cd0130a2cbcd3b97398ba22a5
4
- data.tar.gz: be8a66ad320a48f2acbaa87dbab6862073fa56d9
3
+ metadata.gz: 947eb3ec6ff66507a85bf6b755a6ec73ea01bbb6
4
+ data.tar.gz: 53dbc36684f843eae9a2dab5cc118b7cb0918631
5
5
  SHA512:
6
- metadata.gz: db7da6467829b67a9583d18b9cf25fccc6c9aa241e16643968ae37dfe98c5f01b2b81e3338821aa99b3d049df63b20ba5e35160a4e5db895b0c3746bae686297
7
- data.tar.gz: 3f9df0db4f9a850131c100a2fdde41213e24000e9c3df62fe9d92b21f3a75179c940b8a3ba882097b27dfb0c6105257da0eb37612db3c67382c635c7fa534672
6
+ metadata.gz: 6065a2da2817620cc64ef55b682d042d661e04f7612bd47f010b4ae31ea62477f1828531e21c70af6ebe7dc5fb1ae8409e422dd0ae68d3cc2eb6da36ae66ff6a
7
+ data.tar.gz: ff00629721be7560b4f4cc1ed78fd4a13a2c7a0e826d39453ce92e4f92b158bfbffb660d0084bf519c6e96ab1ff7e19fb7201a7af696d73f69b2229eea3c859d
@@ -125,7 +125,7 @@
125
125
 
126
126
 
127
127
  <div class="method-source-code" id="final_outcome-source">
128
- <pre><span class="ruby-comment"># File lib/PrivateMethods.rb, line 32</span>
128
+ <pre><span class="ruby-comment"># File lib/PrivateMethods.rb, line 33</span>
129
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
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
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>
@@ -161,7 +161,7 @@
161
161
 
162
162
 
163
163
  <div class="method-source-code" id="player_choice-source">
164
- <pre><span class="ruby-comment"># File lib/PrivateMethods.rb, line 5</span>
164
+ <pre><span class="ruby-comment"># File lib/PrivateMethods.rb, line 6</span>
165
165
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">player_choice</span>
166
166
  <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
167
167
  <span class="ruby-identifier">print</span> <span class="ruby-string">&quot;\nChoose: Rock (r), Paper (p), or Scissors (s): &quot;</span>
@@ -211,7 +211,7 @@
211
211
 
212
212
 
213
213
  <div class="method-source-code" id="player_outcome-source">
214
- <pre><span class="ruby-comment"># File lib/PrivateMethods.rb, line 26</span>
214
+ <pre><span class="ruby-comment"># File lib/PrivateMethods.rb, line 27</span>
215
215
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">player_outcome</span>(<span class="ruby-identifier">plays</span>)
216
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
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>)
@@ -238,12 +238,13 @@ scissors</p>
238
238
  <span class="ruby-node">&quot;computer: #{@computer_score} (ties: #{@ties}).\n&quot;</span>
239
239
  <span class="ruby-keyword">case</span> <span class="ruby-constant">PrivateMethods</span>.<span class="ruby-identifier">final_outcome</span>(<span class="ruby-ivar">@player_score</span>, <span class="ruby-ivar">@computer_score</span>)
240
240
  <span class="ruby-keyword">when</span> <span class="ruby-value">:WIN</span>
241
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;\nPlayer wins!&quot;</span>
241
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;\nPlayer wins!\n&quot;</span>
242
242
  <span class="ruby-keyword">when</span> <span class="ruby-value">:LOSE</span>
243
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;\nComputer wins!&quot;</span>
243
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;\nComputer wins!\n&quot;</span>
244
244
  <span class="ruby-keyword">else</span>
245
- <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;\nIt&#39;s a tie!&quot;</span>
245
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;\nIt&#39;s a tie!\n&quot;</span>
246
246
  <span class="ruby-keyword">end</span>
247
+ <span class="ruby-identifier">print</span> <span class="ruby-string">&quot;\n[press any key to exit game]&quot;</span>
247
248
  <span class="ruby-identifier">gets</span>
248
249
  <span class="ruby-keyword">end</span></pre>
249
250
  </div>
data/doc/created.rid CHANGED
@@ -1,5 +1,5 @@
1
- Mon, 16 Oct 2017 07:42:39 -0700
2
- lib/Constants.rb Sat, 14 Oct 2017 09:28:48 -0700
3
- lib/Main.rb Sun, 15 Oct 2017 16:57:13 -0700
4
- lib/PrivateMethods.rb Thu, 12 Oct 2017 18:36:58 -0700
5
- lib/rpsg/version.rb Sun, 15 Oct 2017 13:26:50 -0700
1
+ Mon, 16 Oct 2017 11:40:37 -0700
2
+ lib/Constants.rb Mon, 16 Oct 2017 10:51:39 -0700
3
+ lib/Main.rb Mon, 16 Oct 2017 11:33:54 -0700
4
+ lib/PrivateMethods.rb Mon, 16 Oct 2017 10:51:29 -0700
5
+ lib/rpsg/version.rb Mon, 16 Oct 2017 07:50:02 -0700
Binary file
Binary file
Binary file
@@ -8,7 +8,7 @@
8
8
  <td><a href="{{ domain }}install">Install</a></td>
9
9
  <td><a href="{{ domain }}update">Update</a></td>
10
10
  <td><a href="{{ domain }}uninstall">Uninstall</a></td>
11
- <td><a href="{{ domain }}code">Master Code</a></td>
11
+ <td><a href="{{ domain }}code">Full Code</a></td>
12
12
  <td><a href="{{ domain }}simple">Simple Code</td>
13
13
  <td><a href="{{ domain }}bundler">{% comment %}Using {% endcomment %}Bundler</a></td>
14
14
  </tr>
@@ -44,3 +44,4 @@ How To Use
44
44
  ________
45
45
 
46
46
  RubyGems page: [https://rubygems.org/gems/rpsg](https://rubygems.org/gems/rpsg){: target="_blank"}
47
+ Source Code: [https://github.com/bag3318/rpsg](https://github.com/bag3318/rpsg){: target="_blank"}
data/docs/_pages/code.txt CHANGED
@@ -1,19 +1,19 @@
1
1
  ---
2
2
  layout: default
3
3
  permalink: /code.html
4
- title: "Master Code - RPSG"
4
+ title: "Complete Code - RPSG"
5
5
  ---
6
6
 
7
7
  {::comment}
8
8
  contains complete RPSG code
9
9
  {:/comment}
10
10
 
11
- # Master Code
11
+ # Complete Code
12
12
 
13
13
  * auto-gen TOC:
14
14
  {:toc}
15
15
 
16
- > The master code will look like this:
16
+ > The complete code will look like this:
17
17
 
18
18
  ```
19
19
  % rpsg
@@ -23,23 +23,31 @@ contains complete RPSG code
23
23
  #!/usr/bin/env ruby
24
24
 
25
25
  =begin
26
- |==============|
27
- | Req Ruby Ver |
28
- |--------------|
29
- | >= v2.0.0 |
30
- |==============|
26
+ |====================================|
27
+ | Req Ruby Ver | Req Ruby Gems Ver |
28
+ |--------------|---------------------|
29
+ | >= v2.0.0 | >= v2.6.0 |
30
+ |====================================|
31
31
  =end
32
32
 
33
33
  # create master class for rpsg
34
34
  class RockPaperScissorsGame
35
35
 
36
+ # specify the version for the rubygem
37
+ module RPSG
38
+ # create version constant for the rubygem
39
+ VERSION = "0.3.3"
40
+ end
41
+
36
42
  # create module that holds all contents for this script
37
43
  module Constants
38
44
 
39
45
  # create 2d list of choices
46
+ protected
40
47
  CHOICES = [['r', 'rock'], ['p', 'paper'], ['s', 'scissors']]
41
48
 
42
49
  # define entry to symbol (key to value)
50
+ protected
43
51
  NTRY_TO_SYM = {
44
52
  CHOICES[0][0] => :ROCK , CHOICES[0][1] => :ROCK ,
45
53
  CHOICES[1][0] => :PAPER , CHOICES[1][1] => :PAPER ,
@@ -47,12 +55,15 @@ class RockPaperScissorsGame
47
55
  }
48
56
 
49
57
  # define valid entries
58
+ protected
50
59
  VALID_ENTRIES = NTRY_TO_SYM.keys
51
60
 
52
61
  # define computer choices
62
+ protected
53
63
  COMPUTER_CHOICES = NTRY_TO_SYM.values
54
64
 
55
65
  # create winners 2d list array with format: winning choice, losing choice
66
+ protected
56
67
  WINNERS = [
57
68
  [:SCISSORS, :PAPER ],
58
69
  [:PAPER , :ROCK ],
@@ -60,11 +71,12 @@ class RockPaperScissorsGame
60
71
  ]
61
72
 
62
73
  # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
74
+ protected
63
75
  LOSERS = WINNERS.map { |winning_choice,losing_choice| [losing_choice,winning_choice] }
64
76
 
65
77
  end
66
78
 
67
- protected_methods :Constants
79
+ # protected_methods :Constants
68
80
 
69
81
  class << self
70
82
  # add continue method for asking the user if they want to play rock paper scissors
@@ -111,15 +123,17 @@ class RockPaperScissorsGame
111
123
  "computer: #{@computer_score} (ties: #{@ties}).\n"
112
124
  case PrivateMethods.final_outcome(@player_score, @computer_score)
113
125
  when :WIN
114
- puts "\nPlayer wins!"
126
+ puts "\nPlayer wins!\n"
115
127
  when :LOSE
116
- puts "\nComputer wins!"
128
+ puts "\nComputer wins!\n"
117
129
  else
118
- puts "\nIt's a tie!"
130
+ puts "\nIt's a tie!\n"
119
131
  end
132
+ print "\n[press any key to exit game]"
120
133
  gets
121
134
  end
122
135
 
136
+ private
123
137
  # add module for private methods for the rpsg calculations
124
138
  module PrivateMethods
125
139
  class << self
@@ -159,9 +173,9 @@ class RockPaperScissorsGame
159
173
  end
160
174
  end
161
175
  end
162
-
176
+ public
163
177
 
164
- private_methods :PrivateMethods
178
+ # private_methods :PrivateMethods
165
179
 
166
180
  end
167
181
 
@@ -7,7 +7,7 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
8
8
  <meta name="theme-color" content="#157878"/>
9
9
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
10
- <link rel="stylesheet" href="/assets/css/style.css?v=ac6ad727448216a7da0d1d39d1fa24bd93badc5d"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a5baafbc722707c67aa6887b8c329cac4fb1a8fe"/>
11
11
  <script src="assets/js/pace.min.js"></script>
12
12
 
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
@@ -91,7 +91,7 @@
91
91
  <td><a href="install">Install</a></td>
92
92
  <td><a href="update">Update</a></td>
93
93
  <td><a href="uninstall">Uninstall</a></td>
94
- <td><a href="code">Master Code</a></td>
94
+ <td><a href="code">Full Code</a></td>
95
95
  <td><a href="simple">Simple Code</td>
96
96
  <td><a href="bundler">Bundler</a></td>
97
97
  </tr>
data/docs/_site/code.html CHANGED
@@ -2,12 +2,12 @@
2
2
  <html lang="en-us">
3
3
  <head>
4
4
  <meta charset="UTF-8"/>
5
- <title>Master Code - RPSG</title>
5
+ <title>Complete Code - RPSG</title>
6
6
  <meta name="description" content="A Ruby Programmed Rock Paper Scissors Game"/>
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
8
8
  <meta name="theme-color" content="#157878"/>
9
9
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
10
- <link rel="stylesheet" href="/assets/css/style.css?v=ac6ad727448216a7da0d1d39d1fa24bd93badc5d"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a5baafbc722707c67aa6887b8c329cac4fb1a8fe"/>
11
11
  <script src="assets/js/pace.min.js"></script>
12
12
 
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
@@ -44,14 +44,14 @@
44
44
 
45
45
  <!-- contains complete RPSG code -->
46
46
 
47
- <h1 id="master-code">Master Code</h1>
47
+ <h1 id="complete-code">Complete Code</h1>
48
48
 
49
49
  <ul id="markdown-toc">
50
- <li><a href="#master-code" id="markdown-toc-master-code">Master Code</a></li>
50
+ <li><a href="#complete-code" id="markdown-toc-complete-code">Complete Code</a></li>
51
51
  </ul>
52
52
 
53
53
  <blockquote>
54
- <p>The master code will look like this:</p>
54
+ <p>The complete code will look like this:</p>
55
55
  </blockquote>
56
56
 
57
57
  <div class="highlighter-rouge"><pre class="highlight"><code>% rpsg
@@ -61,23 +61,31 @@
61
61
  <div class="language-ruby highlighter-rouge"><pre class="highlight"><code><span class="c1">#!/usr/bin/env ruby</span>
62
62
 
63
63
  <span class="cm">=begin
64
- |==============|
65
- | Req Ruby Ver |
66
- |--------------|
67
- | &gt;= v2.0.0 |
68
- |==============|
64
+ |====================================|
65
+ | Req Ruby Ver | Req Ruby Gems Ver |
66
+ |--------------|---------------------|
67
+ | &gt;= v2.0.0 | &gt;= v2.6.0 |
68
+ |====================================|
69
69
  =end</span>
70
70
 
71
71
  <span class="c1"># create master class for rpsg</span>
72
72
  <span class="k">class</span> <span class="nc">RockPaperScissorsGame</span>
73
73
 
74
+ <span class="c1"># specify the version for the rubygem</span>
75
+ <span class="k">module</span> <span class="nn">RPSG</span>
76
+ <span class="c1"># create version constant for the rubygem</span>
77
+ <span class="no">VERSION</span> <span class="o">=</span> <span class="s2">"0.3.3"</span>
78
+ <span class="k">end</span>
79
+
74
80
  <span class="c1"># create module that holds all contents for this script</span>
75
81
  <span class="k">module</span> <span class="nn">Constants</span>
76
82
 
77
83
  <span class="c1"># create 2d list of choices</span>
84
+ <span class="kp">protected</span>
78
85
  <span class="no">CHOICES</span> <span class="o">=</span> <span class="p">[[</span><span class="s1">'r'</span><span class="p">,</span> <span class="s1">'rock'</span><span class="p">],</span> <span class="p">[</span><span class="s1">'p'</span><span class="p">,</span> <span class="s1">'paper'</span><span class="p">],</span> <span class="p">[</span><span class="s1">'s'</span><span class="p">,</span> <span class="s1">'scissors'</span><span class="p">]]</span>
79
86
 
80
87
  <span class="c1"># define entry to symbol (key to value)</span>
88
+ <span class="kp">protected</span>
81
89
  <span class="no">NTRY_TO_SYM</span> <span class="o">=</span> <span class="p">{</span>
82
90
  <span class="no">CHOICES</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=&gt;</span> <span class="ss">:ROCK</span> <span class="p">,</span> <span class="no">CHOICES</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=&gt;</span> <span class="ss">:ROCK</span> <span class="p">,</span>
83
91
  <span class="no">CHOICES</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=&gt;</span> <span class="ss">:PAPER</span> <span class="p">,</span> <span class="no">CHOICES</span><span class="p">[</span><span class="mi">1</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=&gt;</span> <span class="ss">:PAPER</span> <span class="p">,</span>
@@ -85,12 +93,15 @@
85
93
  <span class="p">}</span>
86
94
 
87
95
  <span class="c1"># define valid entries</span>
96
+ <span class="kp">protected</span>
88
97
  <span class="no">VALID_ENTRIES</span> <span class="o">=</span> <span class="no">NTRY_TO_SYM</span><span class="p">.</span><span class="nf">keys</span>
89
98
 
90
99
  <span class="c1"># define computer choices</span>
100
+ <span class="kp">protected</span>
91
101
  <span class="no">COMPUTER_CHOICES</span> <span class="o">=</span> <span class="no">NTRY_TO_SYM</span><span class="p">.</span><span class="nf">values</span>
92
102
 
93
103
  <span class="c1"># create winners 2d list array with format: winning choice, losing choice</span>
104
+ <span class="kp">protected</span>
94
105
  <span class="no">WINNERS</span> <span class="o">=</span> <span class="p">[</span>
95
106
  <span class="p">[</span><span class="ss">:SCISSORS</span><span class="p">,</span> <span class="ss">:PAPER</span> <span class="p">],</span>
96
107
  <span class="p">[</span><span class="ss">:PAPER</span> <span class="p">,</span> <span class="ss">:ROCK</span> <span class="p">],</span>
@@ -98,11 +109,12 @@
98
109
  <span class="p">]</span>
99
110
 
100
111
  <span class="c1"># this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player</span>
112
+ <span class="kp">protected</span>
101
113
  <span class="no">LOSERS</span> <span class="o">=</span> <span class="no">WINNERS</span><span class="p">.</span><span class="nf">map</span> <span class="p">{</span> <span class="o">|</span><span class="n">winning_choice</span><span class="p">,</span><span class="n">losing_choice</span><span class="o">|</span> <span class="p">[</span><span class="n">losing_choice</span><span class="p">,</span><span class="n">winning_choice</span><span class="p">]</span> <span class="p">}</span>
102
114
 
103
115
  <span class="k">end</span>
104
116
 
105
- <span class="nb">protected_methods</span> <span class="ss">:Constants</span>
117
+ <span class="c1"># protected_methods :Constants</span>
106
118
 
107
119
  <span class="k">class</span> <span class="o">&lt;&lt;</span> <span class="nb">self</span>
108
120
  <span class="c1"># add continue method for asking the user if they want to play rock paper scissors</span>
@@ -149,15 +161,17 @@
149
161
  <span class="s2">"computer: </span><span class="si">#{</span><span class="vi">@computer_score</span><span class="si">}</span><span class="s2"> (ties: </span><span class="si">#{</span><span class="vi">@ties</span><span class="si">}</span><span class="s2">).</span><span class="se">\n</span><span class="s2">"</span>
150
162
  <span class="k">case</span> <span class="no">PrivateMethods</span><span class="p">.</span><span class="nf">final_outcome</span><span class="p">(</span><span class="vi">@player_score</span><span class="p">,</span> <span class="vi">@computer_score</span><span class="p">)</span>
151
163
  <span class="k">when</span> <span class="ss">:WIN</span>
152
- <span class="nb">puts</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">Player wins!"</span>
164
+ <span class="nb">puts</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">Player wins!</span><span class="se">\n</span><span class="s2">"</span>
153
165
  <span class="k">when</span> <span class="ss">:LOSE</span>
154
- <span class="nb">puts</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">Computer wins!"</span>
166
+ <span class="nb">puts</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">Computer wins!</span><span class="se">\n</span><span class="s2">"</span>
155
167
  <span class="k">else</span>
156
- <span class="nb">puts</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">It's a tie!"</span>
168
+ <span class="nb">puts</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">It's a tie!</span><span class="se">\n</span><span class="s2">"</span>
157
169
  <span class="k">end</span>
170
+ <span class="nb">print</span> <span class="s2">"</span><span class="se">\n</span><span class="s2">[press any key to exit game]"</span>
158
171
  <span class="nb">gets</span>
159
172
  <span class="k">end</span>
160
173
 
174
+ <span class="kp">private</span>
161
175
  <span class="c1"># add module for private methods for the rpsg calculations</span>
162
176
  <span class="k">module</span> <span class="nn">PrivateMethods</span>
163
177
  <span class="k">class</span> <span class="o">&lt;&lt;</span> <span class="nb">self</span>
@@ -197,9 +211,9 @@
197
211
  <span class="k">end</span>
198
212
  <span class="k">end</span>
199
213
  <span class="k">end</span>
200
-
214
+ <span class="kp">public</span>
201
215
 
202
- <span class="nb">private_methods</span> <span class="ss">:PrivateMethods</span>
216
+ <span class="c1"># private_methods :PrivateMethods</span>
203
217
 
204
218
  <span class="k">end</span>
205
219
 
@@ -220,7 +234,7 @@
220
234
  <td><a href="install">Install</a></td>
221
235
  <td><a href="update">Update</a></td>
222
236
  <td><a href="uninstall">Uninstall</a></td>
223
- <td><a href="code">Master Code</a></td>
237
+ <td><a href="code">Full Code</a></td>
224
238
  <td><a href="simple">Simple Code</td>
225
239
  <td><a href="bundler">Bundler</a></td>
226
240
  </tr>
@@ -7,7 +7,7 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
8
8
  <meta name="theme-color" content="#157878"/>
9
9
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
10
- <link rel="stylesheet" href="/assets/css/style.css?v=ac6ad727448216a7da0d1d39d1fa24bd93badc5d"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a5baafbc722707c67aa6887b8c329cac4fb1a8fe"/>
11
11
  <script src="assets/js/pace.min.js"></script>
12
12
 
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
@@ -66,7 +66,7 @@
66
66
  <td><a href="install">Install</a></td>
67
67
  <td><a href="update">Update</a></td>
68
68
  <td><a href="uninstall">Uninstall</a></td>
69
- <td><a href="code">Master Code</a></td>
69
+ <td><a href="code">Full Code</a></td>
70
70
  <td><a href="simple">Simple Code</td>
71
71
  <td><a href="bundler">Bundler</a></td>
72
72
  </tr>
@@ -7,7 +7,7 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
8
8
  <meta name="theme-color" content="#157878"/>
9
9
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
10
- <link rel="stylesheet" href="/assets/css/style.css?v=ac6ad727448216a7da0d1d39d1fa24bd93badc5d"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a5baafbc722707c67aa6887b8c329cac4fb1a8fe"/>
11
11
  <script src="assets/js/pace.min.js"></script>
12
12
 
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
@@ -228,7 +228,7 @@
228
228
  <td><a href="install">Install</a></td>
229
229
  <td><a href="update">Update</a></td>
230
230
  <td><a href="uninstall">Uninstall</a></td>
231
- <td><a href="code">Master Code</a></td>
231
+ <td><a href="code">Full Code</a></td>
232
232
  <td><a href="simple">Simple Code</td>
233
233
  <td><a href="bundler">Bundler</a></td>
234
234
  </tr>
@@ -7,7 +7,7 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
8
8
  <meta name="theme-color" content="#157878"/>
9
9
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
10
- <link rel="stylesheet" href="/assets/css/style.css?v=ac6ad727448216a7da0d1d39d1fa24bd93badc5d"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a5baafbc722707c67aa6887b8c329cac4fb1a8fe"/>
11
11
  <script src="assets/js/pace.min.js"></script>
12
12
 
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
@@ -101,7 +101,8 @@
101
101
 
102
102
  <hr />
103
103
 
104
- <p>RubyGems page: <a href="https://rubygems.org/gems/rpsg" target="_blank">https://rubygems.org/gems/rpsg</a></p>
104
+ <p>RubyGems page: <a href="https://rubygems.org/gems/rpsg" target="_blank">https://rubygems.org/gems/rpsg</a>
105
+ Source Code: <a href="https://github.com/bag3318/rpsg" target="_blank">https://github.com/bag3318/rpsg</a></p>
105
106
 
106
107
 
107
108
  <footer class="site-footer">
@@ -114,7 +115,7 @@
114
115
  <td><a href="install">Install</a></td>
115
116
  <td><a href="update">Update</a></td>
116
117
  <td><a href="uninstall">Uninstall</a></td>
117
- <td><a href="code">Master Code</a></td>
118
+ <td><a href="code">Full Code</a></td>
118
119
  <td><a href="simple">Simple Code</td>
119
120
  <td><a href="bundler">Bundler</a></td>
120
121
  </tr>
@@ -7,7 +7,7 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
8
8
  <meta name="theme-color" content="#157878"/>
9
9
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
10
- <link rel="stylesheet" href="/assets/css/style.css?v=ac6ad727448216a7da0d1d39d1fa24bd93badc5d"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a5baafbc722707c67aa6887b8c329cac4fb1a8fe"/>
11
11
  <script src="assets/js/pace.min.js"></script>
12
12
 
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
@@ -94,7 +94,7 @@
94
94
  <td><a href="install">Install</a></td>
95
95
  <td><a href="update">Update</a></td>
96
96
  <td><a href="uninstall">Uninstall</a></td>
97
- <td><a href="code">Master Code</a></td>
97
+ <td><a href="code">Full Code</a></td>
98
98
  <td><a href="simple">Simple Code</td>
99
99
  <td><a href="bundler">Bundler</a></td>
100
100
  </tr>
data/docs/_site/test.html CHANGED
@@ -7,7 +7,7 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
8
8
  <meta name="theme-color" content="#157878"/>
9
9
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
10
- <link rel="stylesheet" href="/assets/css/style.css?v=ac6ad727448216a7da0d1d39d1fa24bd93badc5d"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a5baafbc722707c67aa6887b8c329cac4fb1a8fe"/>
11
11
  <script src="assets/js/pace.min.js"></script>
12
12
 
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
@@ -82,7 +82,7 @@
82
82
  <td><a href="install">Install</a></td>
83
83
  <td><a href="update">Update</a></td>
84
84
  <td><a href="uninstall">Uninstall</a></td>
85
- <td><a href="code">Master Code</a></td>
85
+ <td><a href="code">Full Code</a></td>
86
86
  <td><a href="simple">Simple Code</td>
87
87
  <td><a href="bundler">Bundler</a></td>
88
88
  </tr>
@@ -7,7 +7,7 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
8
8
  <meta name="theme-color" content="#157878"/>
9
9
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
10
- <link rel="stylesheet" href="/assets/css/style.css?v=ac6ad727448216a7da0d1d39d1fa24bd93badc5d"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a5baafbc722707c67aa6887b8c329cac4fb1a8fe"/>
11
11
  <script src="assets/js/pace.min.js"></script>
12
12
 
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
@@ -75,7 +75,7 @@
75
75
  <td><a href="install">Install</a></td>
76
76
  <td><a href="update">Update</a></td>
77
77
  <td><a href="uninstall">Uninstall</a></td>
78
- <td><a href="code">Master Code</a></td>
78
+ <td><a href="code">Full Code</a></td>
79
79
  <td><a href="simple">Simple Code</td>
80
80
  <td><a href="bundler">Bundler</a></td>
81
81
  </tr>
@@ -7,7 +7,7 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
8
8
  <meta name="theme-color" content="#157878"/>
9
9
  <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
10
- <link rel="stylesheet" href="/assets/css/style.css?v=ac6ad727448216a7da0d1d39d1fa24bd93badc5d"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a5baafbc722707c67aa6887b8c329cac4fb1a8fe"/>
11
11
  <script src="assets/js/pace.min.js"></script>
12
12
 
13
13
  <link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
@@ -75,7 +75,7 @@
75
75
  <td><a href="install">Install</a></td>
76
76
  <td><a href="update">Update</a></td>
77
77
  <td><a href="uninstall">Uninstall</a></td>
78
- <td><a href="code">Master Code</a></td>
78
+ <td><a href="code">Full Code</a></td>
79
79
  <td><a href="simple">Simple Code</td>
80
80
  <td><a href="bundler">Bundler</a></td>
81
81
  </tr>
data/lib/Constants.rb CHANGED
@@ -2,9 +2,11 @@
2
2
  module Constants
3
3
 
4
4
  # create 2d list of choices
5
+ protected
5
6
  CHOICES = [['r', 'rock'], ['p', 'paper'], ['s', 'scissors']]
6
7
 
7
8
  # define entry to symbol (key to value)
9
+ protected
8
10
  NTRY_TO_SYM = {
9
11
  CHOICES[0][0] => :ROCK , CHOICES[0][1] => :ROCK ,
10
12
  CHOICES[1][0] => :PAPER , CHOICES[1][1] => :PAPER ,
@@ -12,12 +14,15 @@ module Constants
12
14
  }
13
15
 
14
16
  # define valid entries
17
+ protected
15
18
  VALID_ENTRIES = NTRY_TO_SYM.keys
16
19
 
17
20
  # define computer choices
21
+ protected
18
22
  COMPUTER_CHOICES = NTRY_TO_SYM.values
19
23
 
20
24
  # create winners 2d list array with format: winning choice, losing choice
25
+ protected
21
26
  WINNERS = [
22
27
  [:SCISSORS, :PAPER ],
23
28
  [:PAPER , :ROCK ],
@@ -25,6 +30,7 @@ module Constants
25
30
  ]
26
31
 
27
32
  # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
33
+ protected
28
34
  LOSERS = WINNERS.map { |winning_choice,losing_choice| [losing_choice,winning_choice] }
29
35
 
30
36
  end
data/lib/Main.rb CHANGED
@@ -5,7 +5,7 @@ class RockPaperScissorsGame
5
5
 
6
6
  require "Constants.rb"
7
7
 
8
- protected_methods :Constants
8
+ # protected_methods :Constants
9
9
 
10
10
  class << self
11
11
  # add continue method for asking the user if they want to play rock paper scissors
@@ -52,18 +52,19 @@ class RockPaperScissorsGame
52
52
  "computer: #{@computer_score} (ties: #{@ties}).\n"
53
53
  case PrivateMethods.final_outcome(@player_score, @computer_score)
54
54
  when :WIN
55
- puts "\nPlayer wins!"
55
+ puts "\nPlayer wins!\n"
56
56
  when :LOSE
57
- puts "\nComputer wins!"
57
+ puts "\nComputer wins!\n"
58
58
  else
59
- puts "\nIt's a tie!"
59
+ puts "\nIt's a tie!\n"
60
60
  end
61
+ print "\n[press any key to exit game]"
61
62
  gets
62
63
  end
63
64
 
64
65
  require "PrivateMethods.rb"
65
66
 
66
- private_methods :PrivateMethods
67
+ # private_methods :PrivateMethods
67
68
 
68
69
  end
69
70
 
@@ -1,3 +1,4 @@
1
+ private
1
2
  # add module for private methods for the rpsg calculations
2
3
  module PrivateMethods
3
4
  class << self
@@ -37,3 +38,4 @@ module PrivateMethods
37
38
  end
38
39
  end
39
40
  end
41
+ public
data/lib/rpsg/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # specify the version for the rubygem
2
2
  module RPSG
3
3
  # create version constant for the rubygem
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
data/rpsg.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "rpsg"
3
- spec.version = "0.3.2"
3
+ spec.version = "0.3.3"
4
4
  spec.date = "2017-10-16" # format: YYYY/MM/DD
5
5
  spec.summary = "A Rock Paper Scissors Game RubyGem"
6
6
  spec.description = <<-EOF
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpsg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - bag3318