rpsg 0.4.0 → 0.4.1

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: 28400ed6462580c54f7836bf35ebcf0bb5b1cda2
4
- data.tar.gz: be664504d11738ff687c0282f84f51a855ebc804
3
+ metadata.gz: 4b36f8cc53eb9d7731b99964e1b024206d7bc955
4
+ data.tar.gz: 3afaa5ae67a5a9a116b2b14fdd5cd164420813a3
5
5
  SHA512:
6
- metadata.gz: '04837ebbc3db799ded560a28c3ff82e7ccec72822cfb1231991f613e7e218f704bd0eb86be8e0b835e1280c502f2908f89b3ac2d7aefc73bfc8bf64da144537b'
7
- data.tar.gz: 1db159a9ef3d767050684a442e7f642ff45919d4ee12bdcfcd34aa7de51e107aa3953f40a94da6c905f269707d977e4a47d260ab00d1f390dddeade3164fbf40
6
+ metadata.gz: 7906fe38b50d938de904b48c89cb24cbff143455f9ed1c74123770008019fee74512a37d300773302d59eb6b2cf7bb75e262ecf33dc496002be50e3c45fcbf4f
7
+ data.tar.gz: 947d6492bd32c15f37683b0964f753f003542471dafb51054963a18880e7569133164942f9eaeb0845a761e08438392986705107f57483dae4692864815a1ea5
@@ -133,7 +133,7 @@ scissors</p>
133
133
 
134
134
 
135
135
  <div class="method-source-code" id="continue-source">
136
- <pre><span class="ruby-comment"># File lib/Main.rb, line 13</span>
136
+ <pre><span class="ruby-comment"># File lib/Main.rb, line 12</span>
137
137
  <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>)
138
138
  <span class="ruby-identifier">puts</span> <span class="ruby-identifier">str1</span>
139
139
  <span class="ruby-identifier">print</span> <span class="ruby-identifier">str2</span>
@@ -169,7 +169,7 @@ scissors</p>
169
169
 
170
170
 
171
171
  <div class="method-source-code" id="new-source">
172
- <pre><span class="ruby-comment"># File lib/Main.rb, line 25</span>
172
+ <pre><span class="ruby-comment"># File lib/Main.rb, line 24</span>
173
173
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
174
174
  <span class="ruby-comment"># initialize variables and set all equal to zero</span>
175
175
  <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>
@@ -212,7 +212,7 @@ scissors</p>
212
212
 
213
213
 
214
214
  <div class="method-source-code" id="play-source">
215
- <pre><span class="ruby-comment"># File lib/Main.rb, line 31</span>
215
+ <pre><span class="ruby-comment"># File lib/Main.rb, line 30</span>
216
216
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">play</span>(<span class="ruby-identifier">winning_score</span>)
217
217
  <span class="ruby-comment"># make while loop</span>
218
218
  <span class="ruby-keyword">while</span> <span class="ruby-ivar">@player_score</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">winning_score</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@computer_score</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">winning_score</span>
@@ -1,5 +1,5 @@
1
- Sat, 28 Oct 2017 17:38:50 -0700
2
- lib/Constants.rb Sat, 28 Oct 2017 17:38:26 -0700
3
- lib/Main.rb Sat, 28 Oct 2017 17:32:37 -0700
1
+ Sat, 28 Oct 2017 19:31:49 -0700
2
+ lib/Main.rb Sat, 28 Oct 2017 19:30:37 -0700
4
3
  lib/PrivateMethods.rb Sat, 28 Oct 2017 11:29:09 -0700
5
- lib/rpsg/version.rb Sat, 28 Oct 2017 17:38:37 -0700
4
+ lib/ProtectedConstants.rb Sat, 28 Oct 2017 19:29:59 -0700
5
+ lib/rpsg/version.rb Sat, 28 Oct 2017 19:30:06 -0700
Binary file
Binary file
Binary file
@@ -36,16 +36,18 @@ class RockPaperScissorsGame
36
36
  # specify the version for the rubygem
37
37
  module RPSG
38
38
  # create version constant for the rubygem
39
- VERSION = "0.4.0"
39
+ VERSION = "0.4.1"
40
40
  end
41
41
 
42
42
  # create module that holds all contents for this script
43
43
  module ProtectedConstants
44
44
 
45
45
  # create 2d list of choices
46
+ protected
46
47
  CHOICES = [['r', 'rock'], ['p', 'paper'], ['s', 'scissors']]
47
48
 
48
49
  # define entry to symbol (key to value) dictionary
50
+ protected
49
51
  NTRY_TO_SYM = {
50
52
  CHOICES[0][0] => :ROCK , CHOICES[0][1] => :ROCK ,
51
53
  CHOICES[1][0] => :PAPER , CHOICES[1][1] => :PAPER ,
@@ -53,9 +55,11 @@ class RockPaperScissorsGame
53
55
  }
54
56
 
55
57
  # define valid entries
58
+ protected
56
59
  VALID_ENTRIES = NTRY_TO_SYM.keys
57
60
 
58
61
  # define computer choices
62
+ protected
59
63
  COMPUTER_CHOICES = NTRY_TO_SYM.values
60
64
 
61
65
  # create winners 2d list array with format: winning choice, losing choice
@@ -67,11 +71,12 @@ class RockPaperScissorsGame
67
71
  ]
68
72
 
69
73
  # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
74
+ protected
70
75
  LOSERS = WINNERS.map { |winning_choice,losing_choice| [losing_choice,winning_choice] }
71
76
 
72
77
  end
73
78
 
74
- protected_methods :ProtectedConstants
79
+ # protected_methods :ProtectedConstants
75
80
 
76
81
  class << self
77
82
  # add continue method for asking the user if they want to play rock paper scissors
@@ -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=3212d5947974f00be97b37621b454665d28682ef"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a05748f4c68340abcebe6fa7337ffcf4443a0aec"/>
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"/>
@@ -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=3212d5947974f00be97b37621b454665d28682ef"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a05748f4c68340abcebe6fa7337ffcf4443a0aec"/>
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"/>
@@ -74,16 +74,18 @@
74
74
  <span class="c1"># specify the version for the rubygem</span>
75
75
  <span class="k">module</span> <span class="nn">RPSG</span>
76
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.4.0"</span>
77
+ <span class="no">VERSION</span> <span class="o">=</span> <span class="s2">"0.4.1"</span>
78
78
  <span class="k">end</span>
79
79
 
80
80
  <span class="c1"># create module that holds all contents for this script</span>
81
81
  <span class="k">module</span> <span class="nn">ProtectedConstants</span>
82
82
 
83
83
  <span class="c1"># create 2d list of choices</span>
84
+ <span class="kp">protected</span>
84
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>
85
86
 
86
87
  <span class="c1"># define entry to symbol (key to value) dictionary</span>
88
+ <span class="kp">protected</span>
87
89
  <span class="no">NTRY_TO_SYM</span> <span class="o">=</span> <span class="p">{</span>
88
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>
89
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>
@@ -91,9 +93,11 @@
91
93
  <span class="p">}</span>
92
94
 
93
95
  <span class="c1"># define valid entries</span>
96
+ <span class="kp">protected</span>
94
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>
95
98
 
96
99
  <span class="c1"># define computer choices</span>
100
+ <span class="kp">protected</span>
97
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>
98
102
 
99
103
  <span class="c1"># create winners 2d list array with format: winning choice, losing choice</span>
@@ -105,11 +109,12 @@
105
109
  <span class="p">]</span>
106
110
 
107
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>
108
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>
109
114
 
110
115
  <span class="k">end</span>
111
116
 
112
- <span class="nb">protected_methods</span> <span class="ss">:ProtectedConstants</span>
117
+ <span class="c1"># protected_methods :ProtectedConstants</span>
113
118
 
114
119
  <span class="k">class</span> <span class="o">&lt;&lt;</span> <span class="nb">self</span>
115
120
  <span class="c1"># add continue method for asking the user if they want to play rock paper scissors</span>
@@ -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=3212d5947974f00be97b37621b454665d28682ef"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a05748f4c68340abcebe6fa7337ffcf4443a0aec"/>
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"/>
@@ -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=3212d5947974f00be97b37621b454665d28682ef"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a05748f4c68340abcebe6fa7337ffcf4443a0aec"/>
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"/>
@@ -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=3212d5947974f00be97b37621b454665d28682ef"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a05748f4c68340abcebe6fa7337ffcf4443a0aec"/>
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"/>
@@ -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=3212d5947974f00be97b37621b454665d28682ef"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a05748f4c68340abcebe6fa7337ffcf4443a0aec"/>
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"/>
@@ -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=3212d5947974f00be97b37621b454665d28682ef"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a05748f4c68340abcebe6fa7337ffcf4443a0aec"/>
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"/>
@@ -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=3212d5947974f00be97b37621b454665d28682ef"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a05748f4c68340abcebe6fa7337ffcf4443a0aec"/>
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"/>
@@ -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=3212d5947974f00be97b37621b454665d28682ef"/>
10
+ <link rel="stylesheet" href="/assets/css/style.css?v=a05748f4c68340abcebe6fa7337ffcf4443a0aec"/>
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"/>
@@ -3,11 +3,10 @@ class RockPaperScissorsGame
3
3
 
4
4
  require "rpsg/version.rb"
5
5
 
6
- require "Constants.rb"
7
-
8
- protected_methods :ProtectedConstants
9
-
6
+ require "ProtectedConstants.rb"
10
7
 
8
+ # protected_methods :ProtectedConstants
9
+
11
10
  class << self
12
11
  # add continue method for asking the user if they want to play rock paper scissors
13
12
  def continue(str1,str2,str3)
@@ -2,9 +2,11 @@
2
2
  module ProtectedConstants
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) dictionary
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 ProtectedConstants
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 ProtectedConstants
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
@@ -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.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "rpsg"
3
- spec.version = "0.4.0"
3
+ spec.version = "0.4.1"
4
4
  spec.date = "2017-10-28" # 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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - bag3318
@@ -234,9 +234,9 @@ files:
234
234
  - docs/script/release
235
235
  - docs/script/server
236
236
  - docs/thumbnail.png
237
- - lib/Constants.rb
238
237
  - lib/Main.rb
239
238
  - lib/PrivateMethods.rb
239
+ - lib/ProtectedConstants.rb
240
240
  - lib/rpsg/version.rb
241
241
  - rpsg.gemspec
242
242
  - test/test_rpsg.rb