docs/_site/Code.html in PlayRockPaperScissorsGame-2.3.9 vs docs/_site/Code.html in PlayRockPaperScissorsGame-2.4.0

- old
+ new

@@ -5,11 +5,11 @@ <title>Master Code - Play Rock Paper Scissors Game</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=b9ae812d1a9e40be1e66eaa23c3b459c2d3396cc"> + <link rel="stylesheet" href="/assets/css/style.css?v=1f125202e42a106a6b4abb42b4f3e03091e8d2e1"> </head> <body> <section class="page-header"> <h1 class="project-name">Play Rock Paper Scissors Game</h1> <h2 class="project-tagline">A Ruby Programmed Rock Paper Scissors Game</h2> @@ -45,20 +45,20 @@ | &gt;= v2.0.0 | &gt;= v2.6.0 | |====================================| =end</span> -<span class="k">class</span> <span class="nc">PlayRockPaperScissorsGame</span> +<span class="k">class</span> <span class="nc">PlayRockPaperScissorsGame</span> <span class="c1"># define master class</span> <span class="k">module</span> <span class="nn">RockPaperScissors</span> - <span class="no">VERSION</span> <span class="o">=</span> <span class="s2">"2.3.9"</span> <span class="c1"># define version constant</span> + <span class="no">VERSION</span> <span class="o">=</span> <span class="s2">"2.4.0"</span> <span class="c1"># define version constant</span> <span class="k">end</span> <span class="c1"># intiate the colorize gem</span> <span class="nb">require</span> <span class="s2">"colorized_string"</span> - <span class="no">ColorizedString</span><span class="p">.</span><span class="nf">colors</span> - <span class="no">ColorizedString</span><span class="p">.</span><span class="nf">modes</span> + <span class="no">ColorizedString</span><span class="p">.</span><span class="nf">colors</span> <span class="c1"># colors; ex: red, green, blue</span> + <span class="no">ColorizedString</span><span class="p">.</span><span class="nf">modes</span> <span class="c1"># modes; ex: bold, italic, underline</span> <span class="k">module</span> <span class="nn">Constants</span> <span class="no">NTRY_TO_SYM</span> <span class="o">=</span> <span class="p">{</span> <span class="c1"># define constants from an entry to a symbol class</span> <span class="s1">'p'</span> <span class="o">=&gt;</span> <span class="ss">:PAPER</span><span class="p">,</span> <span class="s1">'r'</span> <span class="o">=&gt;</span> <span class="ss">:ROCK</span><span class="p">,</span> @@ -70,11 +70,11 @@ <span class="c1"># format: player choice, computer choice</span> <span class="p">[</span><span class="ss">:SCISSORS</span><span class="p">,</span> <span class="ss">:PAPER</span><span class="p">],</span> <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="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">i</span><span class="p">,</span><span class="n">j</span><span class="o">|</span> <span class="p">[</span><span class="n">j</span><span class="p">,</span><span class="n">i</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="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> <span class="no">INIT_STRINGS</span> <span class="o">=</span> <span class="p">[</span> <span class="no">ColorizedString</span><span class="p">[</span><span class="s2">"You are about to enter a rock-paper-scissors best of 3 match."</span><span class="p">].</span><span class="nf">colorize</span><span class="p">(</span><span class="ss">:green</span><span class="p">),</span> <span class="no">ColorizedString</span><span class="p">[</span><span class="s2">"Press the return/enter key to continue..."</span><span class="p">].</span><span class="nf">colorize</span><span class="p">(</span><span class="ss">:green</span><span class="p">),</span> <span class="s2">""</span> <span class="p">]</span> @@ -163,15 +163,14 @@ <span class="k">return</span> <span class="ss">:TIE</span> <span class="k">if</span> <span class="n">pl</span> <span class="o">=</span> <span class="n">co</span> <span class="c1"># this can never happen due to the code in the play method, but it is worth noting</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> - <span class="nb">private_methods</span> <span class="ss">:PrivateMethods</span> + <span class="nb">private_methods</span> <span class="ss">:PrivateMethods</span> <span class="c1"># make the PrivateMethods module private</span> <span class="k">end</span> -<span class="no">PlayRockPaperScissorsGame</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">play</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="c1"># call the play method and pass in 3 for the winning score</span> - +<span class="no">PlayRockPaperScissorsGame</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">play</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="c1"># call the play method and pass in 3 (0, 1, 2) for the winning score</span> </code></pre> </div> <hr />