PlayRockPaperScissorsGame 2.4.0 → 2.4.1
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
- checksums.yaml.gz.sig +2 -2
- data.tar.gz.sig +1 -1
- data/Gemfile +0 -1
- data/docs/Code.md +10 -5
- data/docs/_site/CODE_OF_CONDUCT.html +2 -2
- data/docs/_site/CONTRIBUTING.html +2 -2
- data/docs/_site/Code.html +9 -7
- data/docs/_site/How_to_Build.html +2 -2
- data/docs/_site/Testing.html +2 -2
- data/docs/_site/index.html +2 -2
- data/lib/rps/version.rb +1 -1
- data/rps.gemspec +1 -1
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6477f600cb00e3938eb3d7b49a3652ef75a6a42a
|
4
|
+
data.tar.gz: df1885d09eac8ec673d0596cb02e8621754ab11f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a6a2aeb3e598ed4606caa7985ce2985aecbfe1adbc273ec2bf145628d6eb3fb0ab1b4587ece60490cf853af25266ac363dd78c23e22c9d8deafa800efb566a2
|
7
|
+
data.tar.gz: 1010d4bd35b358b2c0fe56c3dc64d1282e0dfc35e87bdad1904fc9edd429765383ac60462f5abf8bd3b0b118a31a6a4ff6f28a961ae5c2997d0c139fe9ca7487
|
checksums.yaml.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
~E�Ю�=8����:�<^�|Y/ys��˸k%!q��2F)b-���S��-�ڶ��W�w̧��^�̀0$c(Q����n���rM)�,"Lb<
|
2
|
+
~�0<��������ҥ�hS�� ��;�����WAnW�h ��Gс&"H��λ:���J=��w�Џ�ע��"N5C
|
data.tar.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
��N��)�%FP[��\���ę)���=��Z
|
data/Gemfile
CHANGED
data/docs/Code.md
CHANGED
@@ -9,6 +9,11 @@ title: Master Code - Play Rock Paper Scissors Game
|
|
9
9
|
|
10
10
|
**The master code will look like this:**
|
11
11
|
|
12
|
+
[//]: # (`$ rps`)
|
13
|
+
[//]: # (`> rps`)
|
14
|
+
|
15
|
+
__`% rps`__
|
16
|
+
|
12
17
|
```ruby
|
13
18
|
#!/usr/bin/env ruby
|
14
19
|
|
@@ -24,7 +29,7 @@ title: Master Code - Play Rock Paper Scissors Game
|
|
24
29
|
class PlayRockPaperScissorsGame # define master class
|
25
30
|
|
26
31
|
module RockPaperScissors
|
27
|
-
VERSION = "2.4.
|
32
|
+
VERSION = "2.4.1" # define version constant
|
28
33
|
end
|
29
34
|
|
30
35
|
# intiate the colorize gem
|
@@ -43,8 +48,8 @@ class PlayRockPaperScissorsGame # define master class
|
|
43
48
|
WINNERS = [ # define winners
|
44
49
|
# format: player choice, computer choice
|
45
50
|
[:SCISSORS, :PAPER],
|
46
|
-
[:PAPER, :ROCK],
|
47
|
-
[:ROCK, :SCISSORS]
|
51
|
+
[:PAPER , :ROCK],
|
52
|
+
[:ROCK , :SCISSORS]
|
48
53
|
]
|
49
54
|
LOSERS = WINNERS.map { |wp,lp| [lp,wp] } # this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player
|
50
55
|
INIT_STRINGS = [
|
@@ -56,7 +61,7 @@ class PlayRockPaperScissorsGame # define master class
|
|
56
61
|
|
57
62
|
protected_methods :Constants # make the constants module protected
|
58
63
|
|
59
|
-
class << self # define a self calling method
|
64
|
+
class << self # define a self calling method within the parent class
|
60
65
|
def continue(str1,str2,str3) # pass in 3 parameters
|
61
66
|
puts ColorizedString[str1].colorize(:color => :green)
|
62
67
|
print ColorizedString[str2].colorize(:color => :green)
|
@@ -129,7 +134,7 @@ class PlayRockPaperScissorsGame # define master class
|
|
129
134
|
def player_outcome(plays) # define method for the player's outcome while passing in a parameter of type array
|
130
135
|
return :WIN if Constants::WINNERS.include?(plays) # return a win if the one of the sub-arrays in the winners array is called
|
131
136
|
return :LOSE if Constants::LOSERS.include?(plays) # return a loss if any of the mapped sub-arrays in the losers constant is present
|
132
|
-
return :TIE if !:WIN | !:LOSE
|
137
|
+
return :TIE if !:WIN | !:LOSE # return a tie if not (!x) win or if not loose
|
133
138
|
end
|
134
139
|
def final_outcome(pl,co) # define final outcome method
|
135
140
|
return :WIN if pl > co
|
@@ -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=
|
10
|
+
<link rel="stylesheet" href="/assets/css/style.css?v=8ade7247dbbaa777a46e6b2b762a86575087bb4a">
|
11
11
|
</head>
|
12
12
|
<body>
|
13
13
|
<section class="page-header">
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<h2 class="project-tagline">A Ruby Programmed Rock Paper Scissors Game</h2>
|
16
16
|
|
17
17
|
<a href="http://github.com/bag3318/RockPaperScissors" class="btn">View on GitHub</a>
|
18
|
-
<a href="
|
18
|
+
<a href="" class="btn">Report a Bug</a>
|
19
19
|
|
20
20
|
|
21
21
|
<a href="http://github.com/bag3318/RockPaperScissors/zipball/gh-pages" class="btn">Download .zip</a>
|
@@ -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=
|
10
|
+
<link rel="stylesheet" href="/assets/css/style.css?v=8ade7247dbbaa777a46e6b2b762a86575087bb4a">
|
11
11
|
</head>
|
12
12
|
<body>
|
13
13
|
<section class="page-header">
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<h2 class="project-tagline">A Ruby Programmed Rock Paper Scissors Game</h2>
|
16
16
|
|
17
17
|
<a href="http://github.com/bag3318/RockPaperScissors" class="btn">View on GitHub</a>
|
18
|
-
<a href="
|
18
|
+
<a href="" class="btn">Report a Bug</a>
|
19
19
|
|
20
20
|
|
21
21
|
<a href="http://github.com/bag3318/RockPaperScissors/zipball/gh-pages" class="btn">Download .zip</a>
|
data/docs/_site/Code.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=
|
10
|
+
<link rel="stylesheet" href="/assets/css/style.css?v=8ade7247dbbaa777a46e6b2b762a86575087bb4a">
|
11
11
|
</head>
|
12
12
|
<body>
|
13
13
|
<section class="page-header">
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<h2 class="project-tagline">A Ruby Programmed Rock Paper Scissors Game</h2>
|
16
16
|
|
17
17
|
<a href="http://github.com/bag3318/RockPaperScissors" class="btn">View on GitHub</a>
|
18
|
-
<a href="
|
18
|
+
<a href="" class="btn">Report a Bug</a>
|
19
19
|
|
20
20
|
|
21
21
|
<a href="http://github.com/bag3318/RockPaperScissors/zipball/gh-pages" class="btn">Download .zip</a>
|
@@ -36,6 +36,8 @@
|
|
36
36
|
|
37
37
|
<p><strong>The master code will look like this:</strong></p>
|
38
38
|
|
39
|
+
<p><strong><code class="highlighter-rouge">% rps</code></strong></p>
|
40
|
+
|
39
41
|
<div class="language-ruby highlighter-rouge"><pre class="highlight"><code><span class="c1">#!/usr/bin/env ruby</span>
|
40
42
|
|
41
43
|
<span class="cm">=begin
|
@@ -50,7 +52,7 @@
|
|
50
52
|
<span class="k">class</span> <span class="nc">PlayRockPaperScissorsGame</span> <span class="c1"># define master class</span>
|
51
53
|
|
52
54
|
<span class="k">module</span> <span class="nn">RockPaperScissors</span>
|
53
|
-
<span class="no">VERSION</span> <span class="o">=</span> <span class="s2">"2.4.
|
55
|
+
<span class="no">VERSION</span> <span class="o">=</span> <span class="s2">"2.4.1"</span> <span class="c1"># define version constant</span>
|
54
56
|
<span class="k">end</span>
|
55
57
|
|
56
58
|
<span class="c1"># intiate the colorize gem</span>
|
@@ -69,8 +71,8 @@
|
|
69
71
|
<span class="no">WINNERS</span> <span class="o">=</span> <span class="p">[</span> <span class="c1"># define winners</span>
|
70
72
|
<span class="c1"># format: player choice, computer choice</span>
|
71
73
|
<span class="p">[</span><span class="ss">:SCISSORS</span><span class="p">,</span> <span class="ss">:PAPER</span><span class="p">],</span>
|
72
|
-
<span class="p">[</span><span class="ss">:PAPER</span
|
73
|
-
<span class="p">[</span><span class="ss">:ROCK</span
|
74
|
+
<span class="p">[</span><span class="ss">:PAPER</span> <span class="p">,</span> <span class="ss">:ROCK</span><span class="p">],</span>
|
75
|
+
<span class="p">[</span><span class="ss">:ROCK</span> <span class="p">,</span> <span class="ss">:SCISSORS</span><span class="p">]</span>
|
74
76
|
<span class="p">]</span>
|
75
77
|
<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">wp</span><span class="p">,</span><span class="n">lp</span><span class="o">|</span> <span class="p">[</span><span class="n">lp</span><span class="p">,</span><span class="n">wp</span><span class="p">]</span> <span class="p">}</span> <span class="c1"># this will take the original WINNERS array and flip the symbols, thus returning a loss for the user/player</span>
|
76
78
|
<span class="no">INIT_STRINGS</span> <span class="o">=</span> <span class="p">[</span>
|
@@ -82,7 +84,7 @@
|
|
82
84
|
|
83
85
|
<span class="nb">protected_methods</span> <span class="ss">:Constants</span> <span class="c1"># make the constants module protected</span>
|
84
86
|
|
85
|
-
<span class="k">class</span> <span class="o"><<</span> <span class="nb">self</span> <span class="c1"># define a self calling method
|
87
|
+
<span class="k">class</span> <span class="o"><<</span> <span class="nb">self</span> <span class="c1"># define a self calling method within the parent class</span>
|
86
88
|
<span class="k">def</span> <span class="nf">continue</span><span class="p">(</span><span class="n">str1</span><span class="p">,</span><span class="n">str2</span><span class="p">,</span><span class="n">str3</span><span class="p">)</span> <span class="c1"># pass in 3 parameters</span>
|
87
89
|
<span class="nb">puts</span> <span class="no">ColorizedString</span><span class="p">[</span><span class="n">str1</span><span class="p">].</span><span class="nf">colorize</span><span class="p">(</span><span class="ss">:color</span> <span class="o">=></span> <span class="ss">:green</span><span class="p">)</span>
|
88
90
|
<span class="nb">print</span> <span class="no">ColorizedString</span><span class="p">[</span><span class="n">str2</span><span class="p">].</span><span class="nf">colorize</span><span class="p">(</span><span class="ss">:color</span> <span class="o">=></span> <span class="ss">:green</span><span class="p">)</span>
|
@@ -155,7 +157,7 @@
|
|
155
157
|
<span class="k">def</span> <span class="nf">player_outcome</span><span class="p">(</span><span class="n">plays</span><span class="p">)</span> <span class="c1"># define method for the player's outcome while passing in a parameter of type array</span>
|
156
158
|
<span class="k">return</span> <span class="ss">:WIN</span> <span class="k">if</span> <span class="no">Constants</span><span class="o">::</span><span class="no">WINNERS</span><span class="p">.</span><span class="nf">include?</span><span class="p">(</span><span class="n">plays</span><span class="p">)</span> <span class="c1"># return a win if the one of the sub-arrays in the winners array is called</span>
|
157
159
|
<span class="k">return</span> <span class="ss">:LOSE</span> <span class="k">if</span> <span class="no">Constants</span><span class="o">::</span><span class="no">LOSERS</span><span class="p">.</span><span class="nf">include?</span><span class="p">(</span><span class="n">plays</span><span class="p">)</span> <span class="c1"># return a loss if any of the mapped sub-arrays in the losers constant is present</span>
|
158
|
-
<span class="k">return</span> <span class="ss">:TIE</span> <span class="k">if</span> <span class="o">!</span><span class="ss">:WIN</span> <span class="o">|</span> <span class="o">!</span><span class="ss">:LOSE</span>
|
160
|
+
<span class="k">return</span> <span class="ss">:TIE</span> <span class="k">if</span> <span class="o">!</span><span class="ss">:WIN</span> <span class="o">|</span> <span class="o">!</span><span class="ss">:LOSE</span> <span class="c1"># return a tie if not (!x) win or if not loose</span>
|
159
161
|
<span class="k">end</span>
|
160
162
|
<span class="k">def</span> <span class="nf">final_outcome</span><span class="p">(</span><span class="n">pl</span><span class="p">,</span><span class="n">co</span><span class="p">)</span> <span class="c1"># define final outcome method</span>
|
161
163
|
<span class="k">return</span> <span class="ss">:WIN</span> <span class="k">if</span> <span class="n">pl</span> <span class="o">></span> <span class="n">co</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=
|
10
|
+
<link rel="stylesheet" href="/assets/css/style.css?v=8ade7247dbbaa777a46e6b2b762a86575087bb4a">
|
11
11
|
</head>
|
12
12
|
<body>
|
13
13
|
<section class="page-header">
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<h2 class="project-tagline">A Ruby Programmed Rock Paper Scissors Game</h2>
|
16
16
|
|
17
17
|
<a href="http://github.com/bag3318/RockPaperScissors" class="btn">View on GitHub</a>
|
18
|
-
<a href="
|
18
|
+
<a href="" class="btn">Report a Bug</a>
|
19
19
|
|
20
20
|
|
21
21
|
<a href="http://github.com/bag3318/RockPaperScissors/zipball/gh-pages" class="btn">Download .zip</a>
|
data/docs/_site/Testing.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=
|
10
|
+
<link rel="stylesheet" href="/assets/css/style.css?v=8ade7247dbbaa777a46e6b2b762a86575087bb4a">
|
11
11
|
</head>
|
12
12
|
<body>
|
13
13
|
<section class="page-header">
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<h2 class="project-tagline">A Ruby Programmed Rock Paper Scissors Game</h2>
|
16
16
|
|
17
17
|
<a href="http://github.com/bag3318/RockPaperScissors" class="btn">View on GitHub</a>
|
18
|
-
<a href="
|
18
|
+
<a href="" class="btn">Report a Bug</a>
|
19
19
|
|
20
20
|
|
21
21
|
<a href="http://github.com/bag3318/RockPaperScissors/zipball/gh-pages" class="btn">Download .zip</a>
|
data/docs/_site/index.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=
|
10
|
+
<link rel="stylesheet" href="/assets/css/style.css?v=8ade7247dbbaa777a46e6b2b762a86575087bb4a">
|
11
11
|
</head>
|
12
12
|
<body>
|
13
13
|
<section class="page-header">
|
@@ -15,7 +15,7 @@
|
|
15
15
|
<h2 class="project-tagline">A Ruby Programmed Rock Paper Scissors Game</h2>
|
16
16
|
|
17
17
|
<a href="http://github.com/bag3318/RockPaperScissors" class="btn">View on GitHub</a>
|
18
|
-
<a href="
|
18
|
+
<a href="" class="btn">Report a Bug</a>
|
19
19
|
|
20
20
|
|
21
21
|
<a href="http://github.com/bag3318/RockPaperScissors/zipball/gh-pages" class="btn">Download .zip</a>
|
data/lib/rps/version.rb
CHANGED
data/rps.gemspec
CHANGED
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|