rpsg 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -7
- data/Rakefile +8 -0
- data/bin/rpsg +8 -10
- data/html/Constants.html +138 -0
- data/html/PrivateMethods.html +241 -0
- data/html/README_md.html +139 -0
- data/html/RPSG.html +112 -0
- data/html/RockPapaerScissorsGame.html +268 -0
- data/html/created.rid +7 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +590 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +96 -0
- data/html/js/darkfish.js +161 -0
- data/html/js/jquery.js +4 -0
- data/html/js/navigation.js +142 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +109 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +101 -0
- data/lib/Constants.rb +19 -11
- data/lib/PrivateMethods.rb +4 -0
- data/lib/rpsg/version.rb +3 -1
- data/rpsg.gemspec +1 -1
- data/test/rpsg.rb +1 -0
- metadata +51 -1
data/html/README_md.html
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>README - 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="file">
|
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
|
+
<div class="nav-section">
|
56
|
+
<h3>Table of Contents</h3>
|
57
|
+
|
58
|
+
<ul class="link-list" role="directory">
|
59
|
+
<li><a href="#label-RPSG+-28Rock+Paper+Scissors+Game-29">RPSG (Rock Paper Scissors Game)</a>
|
60
|
+
<li><a href="#label-Requirements">Requirements</a>
|
61
|
+
<li><a href="#label-For+Windows">For Windows</a>
|
62
|
+
<li><a href="#label-For+Mac">For Mac</a>
|
63
|
+
<li><a href="#label-How+To+Use">How To Use</a>
|
64
|
+
<li><a href="#label-Windows">Windows</a>
|
65
|
+
<li><a href="#label-Mac">Mac</a>
|
66
|
+
</ul>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
|
70
|
+
<div id="project-metadata">
|
71
|
+
<div id="fileindex-section" class="nav-section">
|
72
|
+
<h3>Pages</h3>
|
73
|
+
|
74
|
+
<ul class="link-list">
|
75
|
+
|
76
|
+
<li><a href="./README_md.html">README</a>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
</div>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
</nav>
|
83
|
+
|
84
|
+
<main role="main" aria-label="Page README.md">
|
85
|
+
|
86
|
+
<h1 id="label-RPSG+-28Rock+Paper+Scissors+Game-29"><a href="RPSG.html">RPSG</a> (Rock Paper Scissors Game)<span><a href="#label-RPSG+-28Rock+Paper+Scissors+Game-29">¶</a> <a href="#top">↑</a></span></h1>
|
87
|
+
|
88
|
+
<h2 id="label-Requirements">Requirements<span><a href="#label-Requirements">¶</a> <a href="#top">↑</a></span></h2>
|
89
|
+
|
90
|
+
<h3 id="label-For+Windows">For Windows<span><a href="#label-For+Windows">¶</a> <a href="#top">↑</a></span></h3>
|
91
|
+
<ul><li>
|
92
|
+
<p>Ruby</p>
|
93
|
+
</li><li>
|
94
|
+
<p>RubyGems</p>
|
95
|
+
</li></ul>
|
96
|
+
|
97
|
+
<h3 id="label-For+Mac">For Mac<span><a href="#label-For+Mac">¶</a> <a href="#top">↑</a></span></h3>
|
98
|
+
<ul><li>
|
99
|
+
<p>Ruby</p>
|
100
|
+
</li><li>
|
101
|
+
<p>RubyGems</p>
|
102
|
+
</li><li>
|
103
|
+
<p>RVM</p>
|
104
|
+
</li></ul>
|
105
|
+
|
106
|
+
<h2 id="label-How+To+Use">How To Use<span><a href="#label-How+To+Use">¶</a> <a href="#top">↑</a></span></h2>
|
107
|
+
|
108
|
+
<h3 id="label-Windows">Windows<span><a href="#label-Windows">¶</a> <a href="#top">↑</a></span></h3>
|
109
|
+
<ol><li>
|
110
|
+
<p>Open <code>cmd</code> as non-admin * <code>cmd</code> is the <code>Command
|
111
|
+
Prompt</code></p>
|
112
|
+
</li><li>
|
113
|
+
<p>type the following: <code>gem install rpsg</code></p>
|
114
|
+
</li><li>
|
115
|
+
<p>run the following: <code>rpsg</code></p>
|
116
|
+
</li></ol>
|
117
|
+
|
118
|
+
<h3 id="label-Mac">Mac<span><a href="#label-Mac">¶</a> <a href="#top">↑</a></span></h3>
|
119
|
+
<ol><li>
|
120
|
+
<p>Open <code>Terminal</code></p>
|
121
|
+
</li><li>
|
122
|
+
<p>type the following: <code>gem install rpsg</code></p>
|
123
|
+
</li><li>
|
124
|
+
<p>run the following: <code>rpsg</code></p>
|
125
|
+
</li></ol>
|
126
|
+
<hr>
|
127
|
+
|
128
|
+
<p>RubyGems page: <a
|
129
|
+
href="https://rubygems.org/gems/rpsg">rubygems.org/gems/rpsg</a></p>
|
130
|
+
</main>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<footer id="validator-badges" role="contentinfo">
|
135
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
136
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.0.0.
|
137
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
138
|
+
</footer>
|
139
|
+
|
data/html/RPSG.html
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module RPSG - 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-RPSG">
|
66
|
+
<h1 id="module-RPSG" class="module">
|
67
|
+
module RPSG
|
68
|
+
</h1>
|
69
|
+
|
70
|
+
<section class="description">
|
71
|
+
|
72
|
+
<p>specify the version for the rubygem</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="VERSION">VERSION
|
92
|
+
|
93
|
+
<dd><p>create version constant for the rubygem</p>
|
94
|
+
|
95
|
+
|
96
|
+
</dl>
|
97
|
+
</section>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
</section>
|
104
|
+
</main>
|
105
|
+
|
106
|
+
|
107
|
+
<footer id="validator-badges" role="contentinfo">
|
108
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
109
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.0.0.
|
110
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
111
|
+
</footer>
|
112
|
+
|
@@ -0,0 +1,268 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class RockPapaerScissorsGame - 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="class">
|
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
|
+
<div id="parent-class-section" class="nav-section">
|
59
|
+
<h3>Parent</h3>
|
60
|
+
|
61
|
+
|
62
|
+
<p class="link">Object
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
<!-- Method Quickref -->
|
69
|
+
<div id="method-list-section" class="nav-section">
|
70
|
+
<h3>Methods</h3>
|
71
|
+
|
72
|
+
<ul class="link-list" role="directory">
|
73
|
+
|
74
|
+
<li ><a href="#method-c-continue">::continue</a>
|
75
|
+
|
76
|
+
<li ><a href="#method-c-new">::new</a>
|
77
|
+
|
78
|
+
<li ><a href="#method-i-play">#play</a>
|
79
|
+
|
80
|
+
</ul>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
</div>
|
84
|
+
</nav>
|
85
|
+
|
86
|
+
<main role="main" aria-labelledby="class-RockPapaerScissorsGame">
|
87
|
+
<h1 id="class-RockPapaerScissorsGame" class="class">
|
88
|
+
class RockPapaerScissorsGame
|
89
|
+
</h1>
|
90
|
+
|
91
|
+
<section class="description">
|
92
|
+
|
93
|
+
</section>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
109
|
+
<header>
|
110
|
+
<h3>Public Class Methods</h3>
|
111
|
+
</header>
|
112
|
+
|
113
|
+
|
114
|
+
<div id="method-c-continue" class="method-detail ">
|
115
|
+
|
116
|
+
<div class="method-heading">
|
117
|
+
<span class="method-name">continue</span><span
|
118
|
+
class="method-args">(str1,str2,str3)</span>
|
119
|
+
|
120
|
+
<span class="method-click-advice">click to toggle source</span>
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
|
125
|
+
<div class="method-description">
|
126
|
+
|
127
|
+
<p>add continue method for asking the user if they want to play rock paper
|
128
|
+
scissors</p>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<div class="method-source-code" id="continue-source">
|
134
|
+
<pre><span class="ruby-comment"># File bin/rpsg, line 17</span>
|
135
|
+
<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>)
|
136
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">str1</span>
|
137
|
+
<span class="ruby-identifier">print</span> <span class="ruby-identifier">str2</span>
|
138
|
+
<span class="ruby-identifier">gets</span>
|
139
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">str3</span>
|
140
|
+
<span class="ruby-keyword">end</span></pre>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
<div id="method-c-new" class="method-detail ">
|
152
|
+
|
153
|
+
<div class="method-heading">
|
154
|
+
<span class="method-name">new</span><span
|
155
|
+
class="method-args">()</span>
|
156
|
+
|
157
|
+
<span class="method-click-advice">click to toggle source</span>
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
<div class="method-description">
|
163
|
+
|
164
|
+
<p>initialize variables</p>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<div class="method-source-code" id="new-source">
|
170
|
+
<pre><span class="ruby-comment"># File bin/rpsg, line 29</span>
|
171
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
|
172
|
+
<span class="ruby-comment"># set all equal to zero</span>
|
173
|
+
<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>
|
174
|
+
<span class="ruby-keyword">end</span></pre>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
</div>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
</div>
|
183
|
+
|
184
|
+
|
185
|
+
</section>
|
186
|
+
|
187
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
188
|
+
<header>
|
189
|
+
<h3>Public Instance Methods</h3>
|
190
|
+
</header>
|
191
|
+
|
192
|
+
|
193
|
+
<div id="method-i-play" class="method-detail ">
|
194
|
+
|
195
|
+
<div class="method-heading">
|
196
|
+
<span class="method-name">play</span><span
|
197
|
+
class="method-args">(winning_score)</span>
|
198
|
+
|
199
|
+
<span class="method-click-advice">click to toggle source</span>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
|
204
|
+
<div class="method-description">
|
205
|
+
|
206
|
+
<p>define play method, this will be the main function for playing rock paper
|
207
|
+
scissors</p>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
<div class="method-source-code" id="play-source">
|
213
|
+
<pre><span class="ruby-comment"># File bin/rpsg, line 35</span>
|
214
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">play</span>(<span class="ruby-identifier">winning_score</span>)
|
215
|
+
<span class="ruby-comment"># make while loop</span>
|
216
|
+
<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>
|
217
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Player score: #{@player_score}, "</span> <span class="ruby-operator">+</span>
|
218
|
+
<span class="ruby-node">"Computer score: #{@computer_score}, Ties: #{@ties}.\n"</span>
|
219
|
+
<span class="ruby-identifier">player</span> = <span class="ruby-constant">PrivateMethods</span>.<span class="ruby-identifier">player_choice</span>
|
220
|
+
<span class="ruby-identifier">computer</span> = <span class="ruby-constant">Constants</span><span class="ruby-operator">::</span><span class="ruby-constant">COMPUTER_CHOICES</span>.<span class="ruby-identifier">sample</span> <span class="ruby-comment"># chooses a random option</span>
|
221
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"\nPlayer chooses #{player.to_s.downcase}."</span>
|
222
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Computer chooses #{computer.to_s.downcase}.\n"</span>
|
223
|
+
<span class="ruby-keyword">case</span> <span class="ruby-constant">PrivateMethods</span>.<span class="ruby-identifier">player_outcome</span> [<span class="ruby-identifier">player</span>, <span class="ruby-identifier">computer</span>]
|
224
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:WIN</span>
|
225
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"\n#{player.to_s.capitalize} beats #{computer.to_s.downcase}, player wins the round.\n"</span>
|
226
|
+
<span class="ruby-ivar">@player_score</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
227
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:LOSE</span>
|
228
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"\n#{computer.to_s.capitalize} beats #{player.to_s.downcase}, computer wins the round.\n"</span>
|
229
|
+
<span class="ruby-ivar">@computer_score</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
230
|
+
<span class="ruby-keyword">else</span>
|
231
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"\nTie, choose again\n"</span>
|
232
|
+
<span class="ruby-ivar">@ties</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
233
|
+
<span class="ruby-keyword">end</span>
|
234
|
+
<span class="ruby-keyword">end</span>
|
235
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"\nFinal score: player: #{@player_score}, "</span> <span class="ruby-operator">+</span>
|
236
|
+
<span class="ruby-node">"computer: #{@computer_score} (ties: #{@ties}).\n"</span>
|
237
|
+
<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>)
|
238
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:WIN</span>
|
239
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"\nPlayer wins!"</span>
|
240
|
+
<span class="ruby-keyword">when</span> <span class="ruby-value">:LOSE</span>
|
241
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"\nComputer wins!"</span>
|
242
|
+
<span class="ruby-keyword">else</span>
|
243
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"\nIt's a tie!"</span>
|
244
|
+
<span class="ruby-keyword">end</span>
|
245
|
+
<span class="ruby-identifier">gets</span>
|
246
|
+
<span class="ruby-keyword">end</span></pre>
|
247
|
+
</div>
|
248
|
+
|
249
|
+
</div>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
</div>
|
255
|
+
|
256
|
+
|
257
|
+
</section>
|
258
|
+
|
259
|
+
</section>
|
260
|
+
</main>
|
261
|
+
|
262
|
+
|
263
|
+
<footer id="validator-badges" role="contentinfo">
|
264
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
265
|
+
<p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.0.0.
|
266
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
267
|
+
</footer>
|
268
|
+
|