docs/_site/code.html in rpsg-0.3.8 vs docs/_site/code.html in rpsg-0.3.9
- old
+ new
@@ -5,11 +5,11 @@
<title>Complete Code - RPSG</title>
<meta name="description" content="A Ruby Programmed Rock Paper Scissors Game"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="theme-color" content="#157878"/>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700' rel='stylesheet' type='text/css' />
- <link rel="stylesheet" href="/assets/css/style.css?v=a9a8e65953a55274ca0541ca547c64427155db10"/>
+ <link rel="stylesheet" href="/assets/css/style.css?v=b38eec3e6fcf2e0b672ac1cb81d1d83c8d16d85d"/>
<script src="assets/js/pace.min.js"></script>
<link rel="apple-touch-icon" sizes="180x180" href="assets/favicons/apple-touch-icon.png"/>
<link rel="icon" type="image/png" sizes="32x32" href="assets/favicons/favicon-32x32.png"/>
<link rel="icon" type="image/png" sizes="16x16" href="assets/favicons/favicon-16x16.png"/>
@@ -72,34 +72,30 @@
<span class="k">class</span> <span class="nc">RockPaperScissorsGame</span>
<span class="c1"># specify the version for the rubygem</span>
<span class="k">module</span> <span class="nn">RPSG</span>
<span class="c1"># create version constant for the rubygem</span>
- <span class="no">VERSION</span> <span class="o">=</span> <span class="s2">"0.3.8"</span>
+ <span class="no">VERSION</span> <span class="o">=</span> <span class="s2">"0.3.9"</span>
<span class="k">end</span>
<span class="c1"># create module that holds all contents for this script</span>
<span class="k">module</span> <span class="nn">ProtectedConstants</span>
<span class="c1"># create 2d list of choices</span>
- <span class="kp">protected</span> <span class="c1"># make protected</span>
<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>
<span class="c1"># define entry to symbol (key to value) dictionary</span>
- <span class="kp">protected</span> <span class="c1"># make protected</span>
<span class="no">NTRY_TO_SYM</span> <span class="o">=</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">0</span><span class="p">]</span> <span class="o">=></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">=></span> <span class="ss">:ROCK</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">0</span><span class="p">]</span> <span class="o">=></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">=></span> <span class="ss">:PAPER</span> <span class="p">,</span>
<span class="no">CHOICES</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=></span> <span class="ss">:SCISSORS</span><span class="p">,</span> <span class="no">CHOICES</span><span class="p">[</span><span class="mi">2</span><span class="p">][</span><span class="mi">1</span><span class="p">]</span> <span class="o">=></span> <span class="ss">:SCISSORS</span>
<span class="p">}</span>
<span class="c1"># define valid entries</span>
- <span class="kp">protected</span> <span class="c1"># make protected</span>
<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>
<span class="c1"># define computer choices</span>
- <span class="kp">protected</span> <span class="c1"># make protected</span>
<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>
<span class="c1"># create winners 2d list array with format: winning choice, losing choice</span>
<span class="kp">protected</span> <span class="c1"># make protected</span>
<span class="no">WINNERS</span> <span class="o">=</span> <span class="p">[</span>
@@ -107,15 +103,14 @@
<span class="p">[</span><span class="ss">:PAPER</span> <span class="p">,</span> <span class="ss">:ROCK</span> <span class="p">],</span>
<span class="p">[</span><span class="ss">:ROCK</span> <span class="p">,</span> <span class="ss">:SCISSORS</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>
- <span class="kp">protected</span> <span class="c1"># make protected</span>
<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>
<span class="k">end</span>
- <span class="c1"># protected_methods :ProtectedConstants</span>
+ <span class="nb">protected_methods</span> <span class="ss">:ProtectedConstants</span>
<span class="k">class</span> <span class="o"><<</span> <span class="nb">self</span>
<span class="c1"># add continue method for asking the user if they want to play rock paper scissors</span>
<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="nb">puts</span> <span class="n">str1</span>