Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

No docs here, that's for the gh-pages branch

  • Loading branch information...
commit 8f86616050cadfc87aea6d15ca68e2f22bb8ebc8 1 parent 059cb8e
@iain authored
View
67 doc/classes/Elo.html
@@ -1,67 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>: Elo [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <script type='text/javascript'>
- //<![CDATA[
- function popupCode(url) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode(id) {
- var code = document.getElementById(id)
-
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
- return true
- }
-
- // Make codeblocks hidden by default
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
- //]]>
- </script>
- </head>
- <body class='page'>
- <div class='class' id='wrapper'>
- <div class='header'>
- <h1 class='name'>
- <span class='type'>Module</span>
- Elo
- </h1>
- <ol class='paths'>
- <li>
- <a href="../files/lib/elo_rb.html">lib/elo.rb</a>
- </li>
- </ol>
- </div>
- <div id='content'>
- <div id='text'>
- <div id='description'>
- <p>
- The configuration of <a href="Elo.html">Elo</a> is done here.
- </p>
- <p>
- See <a href="../files/README_rdoc.html">README.rdoc</a> for general
- information about <a href="Elo.html">Elo</a>.
- </p>
- </div>
- <div id='section'>
- <div id='class-list'>
- <h2>Classes and Modules</h2>
- Module <a href="Elo/Configuration.html" class="link">Elo::Configuration</a><br />
- Module <a href="Elo/EloHelper.html" class="link">Elo::EloHelper</a><br />
- Class <a href="Elo/Game.html" class="link">Elo::Game</a><br />
- Class <a href="Elo/Player.html" class="link">Elo::Player</a><br />
- Class <a href="Elo/Rating.html" class="link">Elo::Rating</a><br />
- </div>
- </div>
- </div>
- </div>
- <div id='footer-push'></div>
- </div>
- <div id='footer'>
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
- </div>
- </body>
-</html>
View
184 doc/classes/Elo/Configuration.html
@@ -1,184 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>: Elo::Configuration [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <script type='text/javascript'>
- //<![CDATA[
- function popupCode(url) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode(id) {
- var code = document.getElementById(id)
-
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
- return true
- }
-
- // Make codeblocks hidden by default
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
- //]]>
- </script>
- </head>
- <body class='page'>
- <div class='class' id='wrapper'>
- <div class='header'>
- <h1 class='name'>
- <span class='type'>Module</span>
- Elo::Configuration
- </h1>
- <ol class='paths'>
- <li>
- <a href="../../files/lib/elo_rb.html">lib/elo.rb</a>
- </li>
- </ol>
- </div>
- <div id='content'>
- <div id='text'>
- <div id='method-list'>
- <h2>Methods</h2>
- <h3>public instance</h3>
- <ol>
- <li><a href="#M000006">configure</a></li>
- <li><a href="#M000005">k_factor</a></li>
- </ol>
- </div>
- <div id='section'>
- <div id='attribute-list'>
- <h2 class='section-bar'>Attributes</h2>
- <div class='name-list'>
- <table>
- <tr class='top-aligned-row context-row'>
- <td class='context-item-name'>default_k_factor</td>
- <td class='context-item-value'>[RW]</td>
- <td class='context-item-desc'>
-
- The default k-factor is chosen when no k-factor rules apply. K-factor rules
- can be added by using the <tt><a
- href="Configuration.html#M000005">k_factor</a></tt>-method. (default = 15)
- </td>
- </tr>
- <tr class='top-aligned-row context-row'>
- <td class='context-item-name'>default_rating</td>
- <td class='context-item-value'>[RW]</td>
- <td class='context-item-desc'>
-
- This is the rating every player starts out with. (default = 1000)
- </td>
- </tr>
- <tr class='top-aligned-row context-row'>
- <td class='context-item-name'>pro_rating_boundry</td>
- <td class='context-item-value'>[RW]</td>
- <td class='context-item-desc'>
-
- This is the lower boundry of the rating you need to be a pro player. This
- setting is used in the FIDE k-factor rules. (default = 2400)
- </td>
- </tr>
- <tr class='top-aligned-row context-row'>
- <td class='context-item-name'>starter_boundry</td>
- <td class='context-item-value'>[RW]</td>
- <td class='context-item-desc'>
-
- This is the lower boundry in the amount of games played to be a starting
- player This setting is used in the FIDE k-factor rules. (default = 30)
- </td>
- </tr>
- <tr class='top-aligned-row context-row'>
- <td class='context-item-name'>use_FIDE_settings</td>
- <td class='context-item-value'>[RW]</td>
- <td class='context-item-desc'>
-
- Use the settings that FIDE use for determening the K-factor. This is the
- case when all settings are unaltered. (default = true)
-
- <p>
- In short:
- </p>
- <ul>
- <li>K-factor is 25 when a player is a starter (less than 30 games played)
-
- </li>
- <li>K-factor is 10 when a player is a pro (rating above 2400, now or in the
- past)
-
- </li>
- <li>K-factor is 15 when a player in other cases
-
- </li>
- </ul>
- <p>
- If you want to use your own settings, either change the boundry settings,
- or set this setting to false and add you&#8217;re own k-factor rules.
- K-factor rules can be added by using the <tt><a
- href="Configuration.html#M000005">k_factor</a></tt>-method.
- </p>
- </td>
- </tr>
- </table>
- </div>
- </div>
- <div id='methods'>
- <h2>Public instance methods</h2>
- <div class='method public-instance' id='method-M000006'>
- <a name='M000006'></a>
- <div class='synopsis'>
- <span class='name'>configure</span>
- <span class='arguments'>() {|self| ...}</span>
- </div>
- <div class='description'>
- <p>
- Configure <a href="../Elo.html">Elo</a> in a block style.
- </p>
- <pre>Elo.configure do |config|&#x000A; config.setting = value&#x000A;end</pre>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000006-source'); return false">
- [show source]
- </a>
- <pre id='M000006-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 68</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">configure</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A; <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>)&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000005'>
- <a name='M000005'></a>
- <div class='synopsis'>
- <span class='name'>k_factor</span>
- <span class='arguments'>(factor, &amp;rule)</span>
- </div>
- <div class='description'>
- <p>
- Add a K-factor rule. The first argument is the k-factor value. The block
- should return a boolean that determines if this K-factor rule applies. The
- first rule that applies is the one determining the K-factor.
- </p>
- <p>
- The block is instance_eval&#8216;ed into the player, so you can access all
- it&#8217;s properties directly. The K-factor is recalculated every time a
- match is played.
- </p>
- <p>
- By default, the FIDE settings are used (see: <tt>use_FIDE_settings</tt>).
- To implement that yourself, you could write:
- </p>
- <pre>Elo.configure do |config|&#x000A; config.k_factor(10) { pro? or pro_rating? }&#x000A; config.k_factor(25) { starter? }&#x000A; config.default_k_factor = 15&#x000A;end</pre>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000005-source'); return false">
- [show source]
- </a>
- <pre id='M000005-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 30</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">k_factor</span>(<span class="ruby-identifier">factor</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">rule</span>)&#x000A; <span class="ruby-identifier">k_factors</span> <span class="ruby-operator">&lt;&lt;</span> { <span class="ruby-identifier">:factor</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">factor</span>, <span class="ruby-identifier">:rule</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">rule</span> }&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id='footer-push'></div>
- </div>
- <div id='footer'>
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
- </div>
- </body>
-</html>
View
124 doc/classes/Elo/EloHelper.html
@@ -1,124 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>: Elo::EloHelper [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <script type='text/javascript'>
- //<![CDATA[
- function popupCode(url) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode(id) {
- var code = document.getElementById(id)
-
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
- return true
- }
-
- // Make codeblocks hidden by default
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
- //]]>
- </script>
- </head>
- <body class='page'>
- <div class='class' id='wrapper'>
- <div class='header'>
- <h1 class='name'>
- <span class='type'>Module</span>
- Elo::EloHelper
- </h1>
- <ol class='paths'>
- <li>
- <a href="../../files/lib/elo_rb.html">lib/elo.rb</a>
- </li>
- </ol>
- </div>
- <div id='content'>
- <div id='text'>
- <div id='description'>
- <p>
- Common methods for <a href="../Elo.html">Elo</a> classes.
- </p>
- </div>
- <div id='method-list'>
- <h2>Methods</h2>
- <h3>public class</h3>
- <ol>
- <li><a href="#M000001">included</a></li>
- <li><a href="#M000002">new</a></li>
- </ol>
- <h3>public instance</h3>
- <ol>
- <li><a href="#M000003">attributes</a></li>
- </ol>
- </div>
- <div id='section'>
- <div id='class-list'>
- <h2>Classes and Modules</h2>
- Module <a href="EloHelper/ClassMethods.html" class="link">Elo::EloHelper::ClassMethods</a><br />
- </div>
- <div id='methods'>
- <h2>Public class methods</h2>
- <div class='method public-class' id='method-M000001'>
- <a name='M000001'></a>
- <div class='synopsis'>
- <span class='name'>included</span>
- <span class='arguments'>(base)</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
- [show source]
- </a>
- <pre id='M000001-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 98</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)&#x000A; <span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ClassMethods</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-class' id='method-M000002'>
- <a name='M000002'></a>
- <div class='synopsis'>
- <span class='name'>new</span>
- <span class='arguments'>(attributes)</span>
- </div>
- <div class='description'>
- <p>
- Every object can be initialized with a hash, just like in ActiveRecord.
- </p>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
- [show source]
- </a>
- <pre id='M000002-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 103</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span>)&#x000A; <span class="ruby-ivar">@attributes</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">keys</span>&#x000A; <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>&#x000A; <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">attr_reader</span> <span class="ruby-identifier">key</span>&#x000A; <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">&quot;@#{key}&quot;</span>, <span class="ruby-identifier">value</span>)&#x000A; <span class="ruby-keyword kw">end</span>&#x000A; <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">all</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <h2>Public instance methods</h2>
- <div class='method public-instance' id='method-M000003'>
- <a name='M000003'></a>
- <div class='synopsis'>
- <span class='name'>attributes</span>
- <span class='arguments'>()</span>
- </div>
- <div class='description'>
- <p>
- Get a hash of all attributes provided
- </p>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
- [show source]
- </a>
- <pre id='M000003-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 113</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attributes</span>&#x000A; <span class="ruby-identifier">hash</span> = {}&#x000A; <span class="ruby-ivar">@attributes</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attribute</span><span class="ruby-operator">|</span>&#x000A; <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">update</span> <span class="ruby-identifier">attribute</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">send</span>(<span class="ruby-identifier">attribute</span>)&#x000A; <span class="ruby-keyword kw">end</span>&#x000A; <span class="ruby-identifier">hash</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id='footer-push'></div>
- </div>
- <div id='footer'>
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
- </div>
- </body>
-</html>
View
78 doc/classes/Elo/EloHelper/ClassMethods.html
@@ -1,78 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>: Elo::EloHelper::ClassMethods [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='../../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <script type='text/javascript'>
- //<![CDATA[
- function popupCode(url) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode(id) {
- var code = document.getElementById(id)
-
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
- return true
- }
-
- // Make codeblocks hidden by default
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
- //]]>
- </script>
- </head>
- <body class='page'>
- <div class='class' id='wrapper'>
- <div class='header'>
- <h1 class='name'>
- <span class='type'>Module</span>
- Elo::EloHelper::ClassMethods
- </h1>
- <ol class='paths'>
- <li>
- <a href="../../../files/lib/elo_rb.html">lib/elo.rb</a>
- </li>
- </ol>
- </div>
- <div id='content'>
- <div id='text'>
- <div id='method-list'>
- <h2>Methods</h2>
- <h3>public instance</h3>
- <ol>
- <li><a href="#M000004">all</a></li>
- </ol>
- </div>
- <div id='section'>
- <div id='methods'>
- <h2>Public instance methods</h2>
- <div class='method public-instance' id='method-M000004'>
- <a name='M000004'></a>
- <div class='synopsis'>
- <span class='name'>all</span>
- <span class='arguments'>()</span>
- </div>
- <div class='description'>
- <p>
- Provides a list of all instantiated objects of the class.
- </p>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
- [show source]
- </a>
- <pre id='M000004-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 124</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all</span>&#x000A; <span class="ruby-ivar">@all</span> <span class="ruby-operator">||=</span> []&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id='footer-push'></div>
- </div>
- <div id='footer'>
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
- </div>
- </body>
-</html>
View
193 doc/classes/Elo/Game.html
@@ -1,193 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>: Elo::Game [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <script type='text/javascript'>
- //<![CDATA[
- function popupCode(url) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode(id) {
- var code = document.getElementById(id)
-
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
- return true
- }
-
- // Make codeblocks hidden by default
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
- //]]>
- </script>
- </head>
- <body class='page'>
- <div class='class' id='wrapper'>
- <div class='header'>
- <h1 class='name'>
- <span class='type'>Class</span>
- Elo::Game
- </h1>
- <ol class='paths'>
- <li>
- <a href="../../files/lib/elo_rb.html">lib/elo.rb</a>
- </li>
- </ol>
- <div class='parent'>
- Parent:
- <strong>Object</strong>
- </div>
- </div>
- <div id='content'>
- <div id='text'>
- <div id='method-list'>
- <h2>Methods</h2>
- <h3>public instance</h3>
- <ol>
- <li><a href="#M000027">draw</a></li>
- <li><a href="#M000026">lose</a></li>
- <li><a href="#M000030">loser=</a></li>
- <li><a href="#M000031">new_rating</a></li>
- <li><a href="#M000024">result=</a></li>
- <li><a href="#M000028">save</a></li>
- <li><a href="#M000025">win</a></li>
- <li><a href="#M000029">winner=</a></li>
- </ol>
- </div>
- <div id='context'>
- <div id='includes'>
- <h2>Included modules</h2>
- <ol>
- <li><a href="EloHelper.html">EloHelper</a></li>
- </ol>
- </div>
- </div>
- <div id='section'>
- <div id='methods'>
- <h2>Public instance methods</h2>
- <div class='method public-instance' id='method-M000027'>
- <a name='M000027'></a>
- <div class='synopsis'>
- <span class='name'>draw</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000027-source'); return false">
- [show source]
- </a>
- <pre id='M000027-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 229</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw</span>&#x000A; <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">result</span> = <span class="ruby-value">0</span><span class="ruby-value">.5</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000026'>
- <a name='M000026'></a>
- <div class='synopsis'>
- <span class='name'>lose</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000026-source'); return false">
- [show source]
- </a>
- <pre id='M000026-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 225</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lose</span>&#x000A; <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">result</span> = <span class="ruby-value">0</span><span class="ruby-value">.0</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000030'>
- <a name='M000030'></a>
- <div class='synopsis'>
- <span class='name'>loser=</span>
- <span class='arguments'>(player)</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000030-source'); return false">
- [show source]
- </a>
- <pre id='M000030-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 241</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">loser=</span>(<span class="ruby-identifier">player</span>)&#x000A; <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">result</span> = (<span class="ruby-identifier">player</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:one</span> <span class="ruby-operator">?</span> <span class="ruby-value">0</span><span class="ruby-value">.0</span> <span class="ruby-operator">:</span> <span class="ruby-value">1.0</span>)&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000031'>
- <a name='M000031'></a>
- <div class='synopsis'>
- <span class='name'>new_rating</span>
- <span class='arguments'>(player)</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000031-source'); return false">
- [show source]
- </a>
- <pre id='M000031-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 245</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_rating</span>(<span class="ruby-identifier">player</span>)&#x000A; <span class="ruby-identifier">ratings</span>[<span class="ruby-identifier">player</span>].<span class="ruby-identifier">new_rating</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000024'>
- <a name='M000024'></a>
- <div class='synopsis'>
- <span class='name'>result=</span>
- <span class='arguments'>(result)</span>
- </div>
- <div class='description'>
- <p>
- Result is from the perspective of player one.
- </p>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000024-source'); return false">
- [show source]
- </a>
- <pre id='M000024-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 214</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">result=</span>(<span class="ruby-identifier">result</span>)&#x000A; <span class="ruby-ivar">@result</span> = <span class="ruby-identifier">result</span>&#x000A; <span class="ruby-identifier">one</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:played</span>, <span class="ruby-keyword kw">self</span>)&#x000A; <span class="ruby-identifier">two</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:played</span>, <span class="ruby-keyword kw">self</span>)&#x000A; <span class="ruby-identifier">save</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000028'>
- <a name='M000028'></a>
- <div class='synopsis'>
- <span class='name'>save</span>
- <span class='arguments'>()</span>
- </div>
- <div class='description'>
- <p>
- TODO
- </p>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000028-source'); return false">
- [show source]
- </a>
- <pre id='M000028-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 234</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000025'>
- <a name='M000025'></a>
- <div class='synopsis'>
- <span class='name'>win</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000025-source'); return false">
- [show source]
- </a>
- <pre id='M000025-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 221</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">win</span>&#x000A; <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">result</span> = <span class="ruby-value">1.0</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000029'>
- <a name='M000029'></a>
- <div class='synopsis'>
- <span class='name'>winner=</span>
- <span class='arguments'>(player)</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000029-source'); return false">
- [show source]
- </a>
- <pre id='M000029-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 237</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">winner=</span>(<span class="ruby-identifier">player</span>)&#x000A; <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">result</span> = (<span class="ruby-identifier">player</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:one</span> <span class="ruby-operator">?</span> <span class="ruby-value">1.0</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span><span class="ruby-value">.0</span>)&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id='footer-push'></div>
- </div>
- <div id='footer'>
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
- </div>
- </body>
-</html>
View
254 doc/classes/Elo/Player.html
@@ -1,254 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>: Elo::Player [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <script type='text/javascript'>
- //<![CDATA[
- function popupCode(url) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode(id) {
- var code = document.getElementById(id)
-
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
- return true
- }
-
- // Make codeblocks hidden by default
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
- //]]>
- </script>
- </head>
- <body class='page'>
- <div class='class' id='wrapper'>
- <div class='header'>
- <h1 class='name'>
- <span class='type'>Class</span>
- Elo::Player
- </h1>
- <ol class='paths'>
- <li>
- <a href="../../files/lib/elo_rb.html">lib/elo.rb</a>
- </li>
- </ol>
- <div class='parent'>
- Parent:
- <strong>Object</strong>
- </div>
- </div>
- <div id='content'>
- <div id='text'>
- <div id='description'>
- <p>
- A player. You need at least two play a <a href="Game.html">Game</a>.
- </p>
- </div>
- <div id='method-list'>
- <h2>Methods</h2>
- <h3>public instance</h3>
- <ol>
- <li><a href="#M000009">games</a></li>
- <li><a href="#M000008">games_played</a></li>
- <li><a href="#M000014">k_factor</a></li>
- <li><a href="#M000018">loses_from</a></li>
- <li><a href="#M000017">plays_draw</a></li>
- <li><a href="#M000012">pro?</a></li>
- <li><a href="#M000010">pro_rating?</a></li>
- <li><a href="#M000007">rating</a></li>
- <li><a href="#M000013">save</a></li>
- <li><a href="#M000011">starter?</a></li>
- <li><a href="#M000015">versus</a></li>
- <li><a href="#M000016">wins_from</a></li>
- </ol>
- </div>
- <div id='context'>
- <div id='includes'>
- <h2>Included modules</h2>
- <ol>
- <li><a href="EloHelper.html">EloHelper</a></li>
- </ol>
- </div>
- </div>
- <div id='section'>
- <div id='methods'>
- <h2>Public instance methods</h2>
- <div class='method public-instance' id='method-M000009'>
- <a name='M000009'></a>
- <div class='synopsis'>
- <span class='name'>games</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
- [show source]
- </a>
- <pre id='M000009-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 146</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">games</span>&#x000A; <span class="ruby-ivar">@games</span> <span class="ruby-operator">||=</span> []&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000008'>
- <a name='M000008'></a>
- <div class='synopsis'>
- <span class='name'>games_played</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
- [show source]
- </a>
- <pre id='M000008-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 142</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">games_played</span>&#x000A; <span class="ruby-ivar">@games_played</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">games</span>.<span class="ruby-identifier">size</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000014'>
- <a name='M000014'></a>
- <div class='synopsis'>
- <span class='name'>k_factor</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
- [show source]
- </a>
- <pre id='M000014-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 168</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">k_factor</span>&#x000A; <span class="ruby-constant">Elo</span>.<span class="ruby-identifier">applied_k_factors</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>&#x000A; <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rule</span>[<span class="ruby-identifier">:factor</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">instance_eval</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">rule</span>[<span class="ruby-identifier">:rule</span>])&#x000A; <span class="ruby-keyword kw">end</span>&#x000A; <span class="ruby-constant">Elo</span>.<span class="ruby-identifier">default_k_factor</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000018'>
- <a name='M000018'></a>
- <div class='synopsis'>
- <span class='name'>loses_from</span>
- <span class='arguments'>(other_player)</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
- [show source]
- </a>
- <pre id='M000018-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 187</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">loses_from</span>(<span class="ruby-identifier">other_player</span>)&#x000A; <span class="ruby-identifier">versus</span>(<span class="ruby-identifier">other_player</span>).<span class="ruby-identifier">lose</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000017'>
- <a name='M000017'></a>
- <div class='synopsis'>
- <span class='name'>plays_draw</span>
- <span class='arguments'>(other_player)</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
- [show source]
- </a>
- <pre id='M000017-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 183</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">plays_draw</span>(<span class="ruby-identifier">other_player</span>)&#x000A; <span class="ruby-identifier">versus</span>(<span class="ruby-identifier">other_player</span>).<span class="ruby-identifier">draw</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000012'>
- <a name='M000012'></a>
- <div class='synopsis'>
- <span class='name'>pro?</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
- [show source]
- </a>
- <pre id='M000012-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 158</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pro?</span>&#x000A; <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-ivar">@pro</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000010'>
- <a name='M000010'></a>
- <div class='synopsis'>
- <span class='name'>pro_rating?</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
- [show source]
- </a>
- <pre id='M000010-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 150</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pro_rating?</span>&#x000A; <span class="ruby-identifier">rating</span> <span class="ruby-operator">&gt;</span> <span class="ruby-constant">Elo</span>.<span class="ruby-identifier">pro_rating_boundry</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000007'>
- <a name='M000007'></a>
- <div class='synopsis'>
- <span class='name'>rating</span>
- <span class='arguments'>()</span>
- </div>
- <div class='description'>
- <p>
- <a href="Rating.html">Rating</a>
- </p>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
- [show source]
- </a>
- <pre id='M000007-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 138</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rating</span>&#x000A; <span class="ruby-ivar">@rating</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Elo</span>.<span class="ruby-identifier">default_rating</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000013'>
- <a name='M000013'></a>
- <div class='synopsis'>
- <span class='name'>save</span>
- <span class='arguments'>()</span>
- </div>
- <div class='description'>
- <p>
- TODO
- </p>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
- [show source]
- </a>
- <pre id='M000013-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 163</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>&#x000A; <span class="ruby-comment cmt"># hook for your own model</span>&#x000A; <span class="ruby-comment cmt"># which I don't know yet how to do</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000011'>
- <a name='M000011'></a>
- <div class='synopsis'>
- <span class='name'>starter?</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
- [show source]
- </a>
- <pre id='M000011-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 154</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">starter?</span>&#x000A; <span class="ruby-identifier">games_played</span> <span class="ruby-operator">&lt;</span> <span class="ruby-constant">Elo</span>.<span class="ruby-identifier">starter_boundry</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000015'>
- <a name='M000015'></a>
- <div class='synopsis'>
- <span class='name'>versus</span>
- <span class='arguments'>(other_player)</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
- [show source]
- </a>
- <pre id='M000015-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 175</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">versus</span>(<span class="ruby-identifier">other_player</span>)&#x000A; <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:one</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">:two</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">other_player</span>)&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000016'>
- <a name='M000016'></a>
- <div class='synopsis'>
- <span class='name'>wins_from</span>
- <span class='arguments'>(other_player)</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
- [show source]
- </a>
- <pre id='M000016-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 179</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wins_from</span>(<span class="ruby-identifier">other_player</span>)&#x000A; <span class="ruby-identifier">versus</span>(<span class="ruby-identifier">other_player</span>).<span class="ruby-identifier">win</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id='footer-push'></div>
- </div>
- <div id='footer'>
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
- </div>
- </body>
-</html>
View
141 doc/classes/Elo/Rating.html
@@ -1,141 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>: Elo::Rating [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <script type='text/javascript'>
- //<![CDATA[
- function popupCode(url) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode(id) {
- var code = document.getElementById(id)
-
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
- return true
- }
-
- // Make codeblocks hidden by default
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
- //]]>
- </script>
- </head>
- <body class='page'>
- <div class='class' id='wrapper'>
- <div class='header'>
- <h1 class='name'>
- <span class='type'>Class</span>
- Elo::Rating
- </h1>
- <ol class='paths'>
- <li>
- <a href="../../files/lib/elo_rb.html">lib/elo.rb</a>
- </li>
- </ol>
- <div class='parent'>
- Parent:
- <strong>Object</strong>
- </div>
- </div>
- <div id='content'>
- <div id='text'>
- <div id='method-list'>
- <h2>Methods</h2>
- <h3>public instance</h3>
- <ol>
- <li><a href="#M000022">change</a></li>
- <li><a href="#M000021">expected</a></li>
- <li><a href="#M000023">new_rating</a></li>
- <li><a href="#M000019">result</a></li>
- <li><a href="#M000020">valid_result?</a></li>
- </ol>
- </div>
- <div id='context'>
- <div id='includes'>
- <h2>Included modules</h2>
- <ol>
- <li><a href="EloHelper.html">EloHelper</a></li>
- </ol>
- </div>
- </div>
- <div id='section'>
- <div id='methods'>
- <h2>Public instance methods</h2>
- <div class='method public-instance' id='method-M000022'>
- <a name='M000022'></a>
- <div class='synopsis'>
- <span class='name'>change</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000022-source'); return false">
- [show source]
- </a>
- <pre id='M000022-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 288</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">change</span>&#x000A; <span class="ruby-identifier">k_factor</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> ( <span class="ruby-identifier">result</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">expected</span> )&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000021'>
- <a name='M000021'></a>
- <div class='synopsis'>
- <span class='name'>expected</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000021-source'); return false">
- [show source]
- </a>
- <pre id='M000021-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 284</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expected</span>&#x000A; <span class="ruby-value">1.0</span> <span class="ruby-operator">/</span> ( <span class="ruby-value">1.0</span> <span class="ruby-operator">+</span> ( <span class="ruby-value">10.0</span> <span class="ruby-operator">**</span> ((<span class="ruby-identifier">other_rating</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">old_rating</span>.<span class="ruby-identifier">to_f</span>) <span class="ruby-operator">/</span> <span class="ruby-value">400.0</span>) ) )&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000023'>
- <a name='M000023'></a>
- <div class='synopsis'>
- <span class='name'>new_rating</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000023-source'); return false">
- [show source]
- </a>
- <pre id='M000023-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 292</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_rating</span>&#x000A; (<span class="ruby-identifier">old_rating</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">change</span>).<span class="ruby-identifier">to_i</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000019'>
- <a name='M000019'></a>
- <div class='synopsis'>
- <span class='name'>result</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000019-source'); return false">
- [show source]
- </a>
- <pre id='M000019-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 275</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">result</span>&#x000A; <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Invalid result: #{@result.inspect}&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">valid_result?</span>&#x000A; <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">to_f</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- <div class='method public-instance' id='method-M000020'>
- <a name='M000020'></a>
- <div class='synopsis'>
- <span class='name'>valid_result?</span>
- <span class='arguments'>()</span>
- </div>
- <div class='source'>
- <a class='source-toggle' href='#' onclick="toggleCode('M000020-source'); return false">
- [show source]
- </a>
- <pre id='M000020-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 280</span>&#x000A; <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">valid_result?</span>&#x000A; (<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">1</span>).<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@result</span>&#x000A; <span class="ruby-keyword kw">end</span></pre>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div id='footer-push'></div>
- </div>
- <div id='footer'>
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
- </div>
- </body>
-</html>
View
1  doc/created.rid
@@ -1 +0,0 @@
-Sun, 14 Mar 2010 20:27:55 +0100
View
163 doc/files/README_rdoc.html
@@ -1,163 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>File: README.rdoc [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <script type='text/javascript'>
- //<![CDATA[
- function popupCode(url) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode(id) {
- var code = document.getElementById(id)
-
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
- return true
- }
-
- // Make codeblocks hidden by default
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
- //]]>
- </script>
- </head>
- <body class='page'>
- <div class='file' id='wrapper'>
- <div class='header'>
- <div class='name'>README.rdoc</div>
- <div class='paths'>
- README.rdoc
- </div>
- <div class='last-update'>
- Last Update:
- <span class='datetime'>Sun Mar 14 18:44:10 +0100 2010</span>
- </div>
- </div>
- <div id='content'>
- <div id='text'>
- <div id='description'>
- <h1><a href="../classes/Elo.html">Elo</a></h1>
- <p>
- From <a
- href="http://en.wikipedia.org/wiki/Elo_rating_system">Wikipedia</a>:
- </p>
- <p>
- The <a href="../classes/Elo.html">Elo</a> rating system is a method for
- calculating the relative skill levels of players in two-player games such
- as chess and Go. It is named after its creator Arpad <a
- href="../classes/Elo.html">Elo</a>, a Hungarian-born American physics
- professor.
- </p>
- <p>
- The <a href="../classes/Elo.html">Elo</a> system was invented as an
- improved chess rating system, but today it is also used in many other
- games. It is also used as a rating system for multiplayer competition in a
- number of computer games, and has been adapted to team sports including
- association football, American college football and basketball, and Major
- League Baseball.
- </p>
- <h2>Links</h2>
- <ul>
- <li><a href="http://iain.github.com/elo/doc">API documentation</a>
-
- </li>
- <li><a href="http://github.com/iain/elo">Source Code</a>
-
- </li>
- </ul>
- <h2>Usage</h2>
- <p>
- You need to have at least to players that can play a game (duh).
- </p>
- <pre>bob = Elo::Player.new&#x000A;jane = Elo::Player.new(:rating =&gt; 1500)</pre>
- <p>
- Once you have players, you can register games in a variaty of ways. There
- is more than one way to do it, choose whatever works from your other code:
- </p>
- <pre>game1 = bob.wins_from(jane)&#x000A;game2 = bob.loses_from(jane)&#x000A;game3 = bob.plays_draw(jane)&#x000A;&#x000A;game4 = bob.versus(jane)&#x000A;game4.winner = jane&#x000A;&#x000A;game5 = bob.versus(jane)&#x000A;game5.loser = jane&#x000A;&#x000A;game6 = bob.versus(jane)&#x000A;game6.draw&#x000A;&#x000A;game7 = bob.versus(jane)&#x000A;game7.result = 1 # result is in perspective of bob, so bob wins</pre>
- <p>
- You can get all kinds of info from a player:
- </p>
- <pre>bob.rating&#x000A;bob.pro?&#x000A;bob.starter?&#x000A;bob.pro_rating?&#x000A;bob.games_played&#x000A;bob.games</pre>
- <p>
- Or get a list of players:
- </p>
- <pre>Elo::Player.all</pre>
- <h2>Configuration</h2>
- <p>
- You can configure <a href="../classes/Elo.html">Elo</a> in many ways. In
- it&#8217;s default configuration, it is configured in the same way as the
- <a href="http://www.fide.com/">FIDE</a> (World Chess Foundation).
- </p>
- <p>
- Altering settings to your liking is very easy and very flexible. You can
- even specify your own K-factor rules. Have a look at the Rdoc in the code
- for a complete reference.
- </p>
- <p>
- Here is an example:
- </p>
- <pre>Elo.configure do |config|&#x000A;&#x000A; # Every player starts with a rating of 1000&#x000A; config.default_rating = 1000&#x000A;&#x000A; # A player is considered a pro, when he/she has more than 2400 points&#x000A; config.pro_rating_boundry = 2400&#x000A;&#x000A; # A player is considered a new, when he/she has played less than 30 games&#x000A; config.starter_boundry = 30&#x000A;&#x000A;end</pre>
- <h2>About the K-factor</h2>
- <p>
- The <a href="../classes/Elo.html">Elo</a> rating system knows a variable
- called the &#8220;K-factor&#8221;. The K-factor is used to reward new
- talent and stableize the rating once a player is participating longer.
- </p>
- <p>
- FIDE (the World Chess Foundation), gives players with less than 30 played
- games a K-factor of 25. Normal players get a K-factor of 15 and pro&#8217;s
- get a K-factor of 10. Once you reach a pro status, you&#8217;re K-factor
- never changes, even if your rating drops.
- </p>
- <p>
- You need to provide <a href="../classes/Elo.html">Elo</a> the amount of
- games played, their rating and their pro-status.
- </p>
- <pre>bob = Elo::Player.new(:games_played =&gt; 29, :rating =&gt; 2300, :pro =&gt; true)</pre>
- <p>
- You can define your own K-factors by adding K-factor rules. This code will
- change the K-factor to 12, for every player who&#8217;s name starts with a
- B, and 16 for everybody else.
- </p>
- <pre>Elo.configure do |config|&#x000A; config.k_factor(12) { name =~ /^b/i }&#x000A; config.default_k_factor = 16&#x000A; config.use_FIDE_settings = false&#x000A;end</pre>
- <h2>Installation</h2>
- <pre>gem install elo</pre>
- <h2>Note on Patches/Pull Requests</h2>
- <ul>
- <li>Fork the project.
-
- </li>
- <li>Make your feature addition or bug fix.
-
- </li>
- <li>Add tests for it. This is important so I don&#8217;t break it in a future
- version unintentionally.
-
- </li>
- <li>Commit, do not mess with rakefile, version, or history. (if you want to
- have your own version, that is fine but bump version in a commit by itself
- I can ignore when I pull)
-
- </li>
- <li>Send me a pull request. Bonus points for topic branches.
-
- </li>
- </ul>
- <h2>Copyright</h2>
- <p>
- Copyright &#169; 2010 Iain Hecker. Released under the MIT License
- </p>
- </div>
- <div id='section'>
- </div>
- </div>
- </div>
- <div id='footer-push'></div>
- </div>
- <div id='footer'>
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
- </div>
- </body>
-</html>
View
58 doc/files/lib/elo_rb.html
@@ -1,58 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>File: elo.rb [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <script type='text/javascript'>
- //<![CDATA[
- function popupCode(url) {
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
- }
-
- function toggleCode(id) {
- var code = document.getElementById(id)
-
- code.style.display = code.style.display != 'block' ? 'block' : 'none'
- return true
- }
-
- // Make codeblocks hidden by default
- document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
- //]]>
- </script>
- </head>
- <body class='page'>
- <div class='file' id='wrapper'>
- <div class='header'>
- <h1 class='name'>elo.rb</h1>
- <div class='paths'>
- lib/elo.rb
- </div>
- <div class='last-update'>
- Last Update:
- <span class='datetime'>Sun Mar 14 17:14:00 +0100 2010</span>
- </div>
- </div>
- <div id='content'>
- <div id='text'>
- <div id='description'>
- <p>
- The configuration of <a href="../../classes/Elo.html">Elo</a> is done here.
- </p>
- <p>
- See <a href="../README_rdoc.html">README.rdoc</a> for general information
- about <a href="../../classes/Elo.html">Elo</a>.
- </p>
- </div>
- <div id='section'>
- </div>
- </div>
- </div>
- <div id='footer-push'></div>
- </div>
- <div id='footer'>
- <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
- </div>
- </body>
-</html>
View
21 doc/fr_class_index.html
@@ -1,21 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>Classes [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <base target='docwin'>
- </head>
- <body class='list'>
- <div id='index'>
- <h1>Classes</h1>
- <ol class='classes' id='index-entries'>
- <li><a href="classes/Elo.html">Elo</a>
- <ol><li><a href="classes/Elo/Configuration.html"><span class="parent">Elo::</span>Configuration</a></li><li><a href="classes/Elo/EloHelper.html"><span class="parent">Elo::</span>EloHelper</a>
- <ol><li><a href="classes/Elo/EloHelper/ClassMethods.html"><span class="parent">Elo::EloHelper::</span>ClassMethods</a></li>
- </ol></li><li><a href="classes/Elo/Game.html"><span class="parent">Elo::</span>Game</a></li><li><a href="classes/Elo/Player.html"><span class="parent">Elo::</span>Player</a></li><li><a href="classes/Elo/Rating.html"><span class="parent">Elo::</span>Rating</a></li>
- </ol></li>
- </ol>
- </div>
- </body>
-</html>
View
21 doc/fr_file_index.html
@@ -1,21 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
-<html lang='en'>
- <head>
- <title>Files [elo ]</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- <link href='rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
- <base target='docwin'>
- </head>
- <body class='list'>
- <div id='index'>
- <h1>Files</h1>
- <ol class='files' id='index-entries'>
- <li><a href="files/README_rdoc.html">README.rdoc</a></li>
- <li class='other'><a href="files/lib/elo_rb.html">lib/elo.rb</a></li>
- <li>
- <a class='show' href='#' onclick='this.parentNode.parentNode.className += " expanded"; this.parentNode.removeChild(this); return false'>show all</a>
- </li>
- </ol>
- </div>
- </body>
-</html>
View
4,469 doc/fr_method_index.html
0 additions, 4,469 deletions not shown
View
15 doc/index.html
@@ -1,15 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
-<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
- <head>
- <title>elo</title>
- <meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
- </head>
- <frameset border='1' bordercolor='gray' cols='20%, *' frameborder='1'>
- <frameset rows='15%, 35%, 50%'>
- <frame name='Files' src='fr_file_index.html' title='Files'></frame>
- <frame name='Classes' src='fr_class_index.html'></frame>
- <frame name='Methods' src='fr_method_index.html'></frame>
- </frameset>
- <frame name='docwin' src='files/README_rdoc.html'></frame>
- </frameset>
-</html>
View
328 doc/rdoc-style.css
@@ -1,328 +0,0 @@
-html, body {
- height: 100%; }
-
-body {
- font-family: Lucida Grande, Verdana, Arial, Helvetica, sans-serif;
- font-size: 90%;
- margin: 0;
- padding: 0;
- background: white;
- color: black; }
-
-#wrapper {
- min-height: 100%;
- height: auto !important;
- height: 100%;
- margin: 0 auto -43px; }
-
-#footer-push {
- height: 43px; }
-
-div.header, #footer {
- background: #eee; }
-
-#footer {
- border-top: 1px solid silver;
- margin-top: 12px;
- padding: 0 2em;
- line-height: 30px;
- text-align: center;
- font-variant: small-caps;
- font-size: 95%; }
-
-.clearing:after {
- content: ".";
- visibility: hidden;
- height: 0;
- display: block;
- clear: both; }
-* html .clearing {
- height: 1px; }
-.clearing *:first-child + html {
- overflow: hidden; }
-
-h1, h2, h3, h4, h5, h6 {
- margin: 0;
- font-weight: normal; }
-
-a {
- color: #0b3e71; }
- a:hover {
- background: #336699;
- text-decoration: none;
- color: #eef; }
-
-#diagram img {
- border: 0; }
-
-#description a, .method .description a, .header a {
- color: #336699; }
- #description a:hover, .method .description a:hover, .header a:hover {
- color: #eee; }
-#description h1 a, #description h2 a, #description h3 a, #description h4 a, #description h5 a, #description h6 a, .method .description h1 a, .method .description h2 a, .method .description h3 a, .method .description h4 a, .method .description h5 a, .method .description h6 a, .header h1 a, .header h2 a, .header h3 a, .header h4 a, .header h5 a, .header h6 a {
- color: #0b3e71; }
-
-ol {
- margin: 0;
- padding: 0;
- list-style: none; }
- ol li {
- margin-left: 0;
- white-space: nowrap; }
- ol li.other {
- display: none; }
-
-ol.expanded li.other {
- display: list-item; }
-
-table {
- margin-bottom: 1em;
- font-size: 1em;
- border-collapse: collapse; }
- table td, table th {
- padding: .4em .8em; }
- table thead {
- background-color: #e8e8e8; }
- table thead th {
- font-variant: small-caps;
- color: #666666; }
- table tr {
- border-bottom: 1px solid silver; }
-
-#index a.show, div.header a.show {
- text-decoration: underline;
- font-style: italic;
- color: #666666; }
- #index a.show:after, div.header a.show:after {
- content: " ..."; }
- #index a.show:hover, div.header a.show:hover {
- color: black;
- background: #ffe; }
-
-#index {
- font: 85%/1.2 Arial, Helvetica, sans-serif; }
- #index a {
- text-decoration: none; }
- #index h1 {
- padding: .2em .5em .1em;
- background: #ccc;
- font: small-caps 1.2em Georgia, serif;
- color: #333;
- border-bottom: 1px solid gray; }
- #index form {
- margin: 0;
- padding: 0; }
- #index form input {
- margin: .4em 3px 0 .4em;
- width: 80%; }
- #index form #search.untouched {
- color: #777777; }
- #index form .clear_button {
- -moz-border-radius: 7px;
- -webkit-border-radius: 7px;
- background: #AAA;
- color: white;
- padding: 0 5px 1px 5px;
- cursor: pointer; }
- #index ol {
- padding: .4em .5em; }
- #index ol li {
- white-space: nowrap; }
- #index #index-entries li a {
- padding: 1px 2px; }
- #index #index-entries.classes {
- font-size: 1.1em; }
- #index #index-entries.classes ol {
- padding: 0; }
- #index #index-entries.classes span.nodoc {
- display: none; }
- #index #index-entries.classes span.nodoc, #index #index-entries.classes a {
- font-weight: bold; }
- #index #index-entries.classes .parent {
- font-weight: normal; }
- #index #index-entries.methods li, #index #search-results.methods li {
- margin-bottom: 0.2em; }
- #index #index-entries.methods li a .method_name, #index #search-results.methods li a .method_name {
- margin-right: 0.25em; }
- #index #index-entries.methods li a .module_name, #index #search-results.methods li a .module_name {
- color: #666666; }
- #index #index-entries.methods li a:hover .module_name, #index #search-results.methods li a:hover .module_name {
- color: #ddd; }
-
-#attribute-list .context-item-name {
- font-weight: bold; }
-
-div.header {
- font-size: 80%;
- padding: .5em 2%;
- font-family: Arial, Helvetica, sans-serif;
- border-bottom: 1px solid silver; }
- div.header .name {
- font-size: 1.6em;
- font-family: Georgia, serif; }
- div.header .name .type {
- color: #666666;
- font-size: 80%;
- font-variant: small-caps; }
- div.header h1.name {
- font-size: 2.2em; }
- div.header .paths, div.header .last-update, div.header .parent {
- color: #666666; }
- div.header .last-update .datetime {
- color: #484848; }
- div.header .parent {
- margin-top: .3em; }
- div.header .parent strong {
- font-weight: normal;
- color: #484848; }
-
-#content {
- padding: 12px 2%; }
- div.class #content {
- position: relative;
- width: 72%; }
- #content pre, #content .method .synopsis {
- font: 14px Monaco, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace; }
- #content pre {
- color: black;
- background: #eee;
- border: 1px solid silver;
- padding: .5em .8em;
- overflow: auto; }
- #content p code, #content p tt, #content li code, #content li tt, #content dl code, #content dl tt {
- font: 14px Monaco, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace;
- background: #ffffe3;
- padding: 2px 3px;
- line-height: 1.4; }
- #content h1 code, #content h1 tt, #content h2 code, #content h2 tt, #content h3 code, #content h3 tt, #content h4 code, #content h4 tt, #content h5 code, #content h5 tt, #content h6 code, #content h6 tt {
- font-size: 1.1em; }
- #content #text {
- position: relative; }
- #content #description p {
- margin-top: .5em; }
- #content #description h1, #content #description h2, #content #description h3, #content #description h4, #content #description h5, #content #description h6 {
- font-family: Georgia, serif; }
- #content #description h1 {
- font-size: 2.2em;
- margin-bottom: .2em;
- border-bottom: 3px double #d8d8d8;
- padding-bottom: .1em; }
- #content #description h2 {
- font-size: 1.8em;
- color: #0e3062;
- margin: .8em 0 .3em 0; }
- #content #description h3 {
- font-size: 1.6em;
- margin: .8em 0 .3em 0;
- color: #666666; }
- #content #description h4 {
- font-size: 1.4em;
- margin: .8em 0 .3em 0; }
- #content #description h5 {
- font-size: 1.2em;
- margin: .8em 0 .3em 0;
- color: #0e3062; }
- #content #description h6 {
- font-size: 1.0em;
- margin: .8em 0 .3em 0;
- color: #666666; }
- #content #description ul, #content #description ol, #content .method .description ul, #content .method .description ol {
- margin: .8em 0;
- padding-left: 1.5em; }
- #content #description ol, #content .method .description ol {
- list-style: decimal; }
- #content #description ol li, #content .method .description ol li {
- white-space: normal; }
-
-#method-list {
- position: absolute;
- top: 0px;
- right: -33%;
- width: 28%;
- background: #eee;
- border: 1px solid silver;
- padding: .4em 1%;
- overflow: hidden; }
- #method-list h2 {
- font-size: 1.3em; }
- #method-list h3 {
- font-variant: small-caps;
- text-transform: capitalize;
- font-family: Georgia, serif;
- color: #666;
- font-size: 1.1em; }
- #method-list ol {
- padding: 0 0 .5em .5em; }
-
-#context {
- border-top: 1px dashed silver;
- margin-top: 1em;
- margin-bottom: 1em; }
-
-#context h2, #section h2 {
- font: small-caps 1.2em Georgia, serif;
- color: #444;
- margin: 1em 0 .2em 0; }
-
-#methods .method {
- border: 1px solid silver;
- margin-top: .5em;
- background: #eee; }
- #methods .method .synopsis {
- color: black;
- background: silver;
- padding: .2em 1em; }
- #methods .method .synopsis .name {
- font-weight: bold; }
- #methods .method .synopsis a {
- text-decoration: none; }
- #methods .method .description {
- padding: 0 1em; }
- #methods .method .description pre {
- background: #f8f8f8; }
- #methods .method .source {
- margin: .5em 0; }
- #methods .method .source-toggle {
- font-size: 85%;
- margin-left: 1em; }
-#methods .public-class {
- background: #ffffe4; }
-#methods .public-instance .synopsis {
- color: #eee;
- background: #336699; }
-
-#content .method .source pre {
- background: #262626;
- color: #ffdead;
- margin: 1em;
- padding: 0.5em;
- border: 1px dashed #999;
- overflow: auto; }
- #content .method .source pre .ruby-constant {
- color: #7fffd4;
- background: transparent; }
- #content .method .source pre .ruby-keyword {
- color: #00ffff;
- background: transparent; }
- #content .method .source pre .ruby-ivar {
- color: #eedd82;
- background: transparent; }
- #content .method .source pre .ruby-operator {
- color: #00ffee;
- background: transparent; }
- #content .method .source pre .ruby-identifier {
- color: #ffdead;
- background: transparent; }
- #content .method .source pre .ruby-node {
- color: #ffa07a;
- background: transparent; }
- #content .method .source pre .ruby-comment {
- color: #b22222;
- font-weight: bold;
- background: transparent; }
- #content .method .source pre .ruby-regexp {
- color: #ffa07a;
- background: transparent; }
- #content .method .source pre .ruby-value {
- color: #7fffd4;
- background: transparent; }
Please sign in to comment.
Something went wrong with that request. Please try again.