elo 0.0.2.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/README.rdoc +124 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/doc/classes/Elo.html +67 -0
- data/doc/classes/Elo/Configuration.html +184 -0
- data/doc/classes/Elo/EloHelper.html +124 -0
- data/doc/classes/Elo/EloHelper/ClassMethods.html +78 -0
- data/doc/classes/Elo/Game.html +193 -0
- data/doc/classes/Elo/Player.html +254 -0
- data/doc/classes/Elo/Rating.html +141 -0
- data/doc/created.rid +1 -0
- data/doc/files/README_rdoc.html +163 -0
- data/doc/files/lib/elo_rb.html +58 -0
- data/doc/fr_class_index.html +21 -0
- data/doc/fr_file_index.html +21 -0
- data/doc/fr_method_index.html +4469 -0
- data/doc/index.html +15 -0
- data/doc/rdoc-style.css +328 -0
- data/lib/elo.rb +298 -0
- data/spec/elo_spec.rb +7 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +9 -0
- metadata +102 -0
@@ -0,0 +1,124 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>: Elo::EloHelper [elo ]</title>
|
5
|
+
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
+
<link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
+
<script type='text/javascript'>
|
8
|
+
//<![CDATA[
|
9
|
+
function popupCode(url) {
|
10
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
+
}
|
12
|
+
|
13
|
+
function toggleCode(id) {
|
14
|
+
var code = document.getElementById(id)
|
15
|
+
|
16
|
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
|
20
|
+
// Make codeblocks hidden by default
|
21
|
+
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
+
//]]>
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body class='page'>
|
26
|
+
<div class='class' id='wrapper'>
|
27
|
+
<div class='header'>
|
28
|
+
<h1 class='name'>
|
29
|
+
<span class='type'>Module</span>
|
30
|
+
Elo::EloHelper
|
31
|
+
</h1>
|
32
|
+
<ol class='paths'>
|
33
|
+
<li>
|
34
|
+
<a href="../../files/lib/elo_rb.html">lib/elo.rb</a>
|
35
|
+
</li>
|
36
|
+
</ol>
|
37
|
+
</div>
|
38
|
+
<div id='content'>
|
39
|
+
<div id='text'>
|
40
|
+
<div id='description'>
|
41
|
+
<p>
|
42
|
+
Common methods for <a href="../Elo.html">Elo</a> classes.
|
43
|
+
</p>
|
44
|
+
</div>
|
45
|
+
<div id='method-list'>
|
46
|
+
<h2>Methods</h2>
|
47
|
+
<h3>public class</h3>
|
48
|
+
<ol>
|
49
|
+
<li><a href="#M000001">included</a></li>
|
50
|
+
<li><a href="#M000002">new</a></li>
|
51
|
+
</ol>
|
52
|
+
<h3>public instance</h3>
|
53
|
+
<ol>
|
54
|
+
<li><a href="#M000003">attributes</a></li>
|
55
|
+
</ol>
|
56
|
+
</div>
|
57
|
+
<div id='section'>
|
58
|
+
<div id='class-list'>
|
59
|
+
<h2>Classes and Modules</h2>
|
60
|
+
Module <a href="EloHelper/ClassMethods.html" class="link">Elo::EloHelper::ClassMethods</a><br />
|
61
|
+
</div>
|
62
|
+
<div id='methods'>
|
63
|
+
<h2>Public class methods</h2>
|
64
|
+
<div class='method public-class' id='method-M000001'>
|
65
|
+
<a name='M000001'></a>
|
66
|
+
<div class='synopsis'>
|
67
|
+
<span class='name'>included</span>
|
68
|
+
<span class='arguments'>(base)</span>
|
69
|
+
</div>
|
70
|
+
<div class='source'>
|
71
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000001-source'); return false">
|
72
|
+
[show source]
|
73
|
+
</a>
|
74
|
+
<pre id='M000001-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 98</span>
 <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>)
 <span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ClassMethods</span>
 <span class="ruby-keyword kw">end</span></pre>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
<div class='method public-class' id='method-M000002'>
|
78
|
+
<a name='M000002'></a>
|
79
|
+
<div class='synopsis'>
|
80
|
+
<span class='name'>new</span>
|
81
|
+
<span class='arguments'>(attributes)</span>
|
82
|
+
</div>
|
83
|
+
<div class='description'>
|
84
|
+
<p>
|
85
|
+
Every object can be initialized with a hash, just like in ActiveRecord.
|
86
|
+
</p>
|
87
|
+
</div>
|
88
|
+
<div class='source'>
|
89
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000002-source'); return false">
|
90
|
+
[show source]
|
91
|
+
</a>
|
92
|
+
<pre id='M000002-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 103</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">attributes</span>)
 <span class="ruby-ivar">@attributes</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">keys</span>
 <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>
 <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>
 <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{key}"</span>, <span class="ruby-identifier">value</span>)
 <span class="ruby-keyword kw">end</span>
 <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">all</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">self</span>
 <span class="ruby-keyword kw">end</span></pre>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<h2>Public instance methods</h2>
|
96
|
+
<div class='method public-instance' id='method-M000003'>
|
97
|
+
<a name='M000003'></a>
|
98
|
+
<div class='synopsis'>
|
99
|
+
<span class='name'>attributes</span>
|
100
|
+
<span class='arguments'>()</span>
|
101
|
+
</div>
|
102
|
+
<div class='description'>
|
103
|
+
<p>
|
104
|
+
Get a hash of all attributes provided
|
105
|
+
</p>
|
106
|
+
</div>
|
107
|
+
<div class='source'>
|
108
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000003-source'); return false">
|
109
|
+
[show source]
|
110
|
+
</a>
|
111
|
+
<pre id='M000003-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 113</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attributes</span>
 <span class="ruby-identifier">hash</span> = {}
 <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>
 <span class="ruby-identifier">hash</span>.<span class="ruby-identifier">update</span> <span class="ruby-identifier">attribute</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">send</span>(<span class="ruby-identifier">attribute</span>)
 <span class="ruby-keyword kw">end</span>
 <span class="ruby-identifier">hash</span>
 <span class="ruby-keyword kw">end</span></pre>
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
<div id='footer-push'></div>
|
119
|
+
</div>
|
120
|
+
<div id='footer'>
|
121
|
+
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
122
|
+
</div>
|
123
|
+
</body>
|
124
|
+
</html>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>: Elo::EloHelper::ClassMethods [elo ]</title>
|
5
|
+
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
+
<link href='../../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
+
<script type='text/javascript'>
|
8
|
+
//<![CDATA[
|
9
|
+
function popupCode(url) {
|
10
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
+
}
|
12
|
+
|
13
|
+
function toggleCode(id) {
|
14
|
+
var code = document.getElementById(id)
|
15
|
+
|
16
|
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
|
20
|
+
// Make codeblocks hidden by default
|
21
|
+
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
+
//]]>
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body class='page'>
|
26
|
+
<div class='class' id='wrapper'>
|
27
|
+
<div class='header'>
|
28
|
+
<h1 class='name'>
|
29
|
+
<span class='type'>Module</span>
|
30
|
+
Elo::EloHelper::ClassMethods
|
31
|
+
</h1>
|
32
|
+
<ol class='paths'>
|
33
|
+
<li>
|
34
|
+
<a href="../../../files/lib/elo_rb.html">lib/elo.rb</a>
|
35
|
+
</li>
|
36
|
+
</ol>
|
37
|
+
</div>
|
38
|
+
<div id='content'>
|
39
|
+
<div id='text'>
|
40
|
+
<div id='method-list'>
|
41
|
+
<h2>Methods</h2>
|
42
|
+
<h3>public instance</h3>
|
43
|
+
<ol>
|
44
|
+
<li><a href="#M000004">all</a></li>
|
45
|
+
</ol>
|
46
|
+
</div>
|
47
|
+
<div id='section'>
|
48
|
+
<div id='methods'>
|
49
|
+
<h2>Public instance methods</h2>
|
50
|
+
<div class='method public-instance' id='method-M000004'>
|
51
|
+
<a name='M000004'></a>
|
52
|
+
<div class='synopsis'>
|
53
|
+
<span class='name'>all</span>
|
54
|
+
<span class='arguments'>()</span>
|
55
|
+
</div>
|
56
|
+
<div class='description'>
|
57
|
+
<p>
|
58
|
+
Provides a list of all instantiated objects of the class.
|
59
|
+
</p>
|
60
|
+
</div>
|
61
|
+
<div class='source'>
|
62
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000004-source'); return false">
|
63
|
+
[show source]
|
64
|
+
</a>
|
65
|
+
<pre id='M000004-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 124</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">all</span>
 <span class="ruby-ivar">@all</span> <span class="ruby-operator">||=</span> []
 <span class="ruby-keyword kw">end</span></pre>
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
<div id='footer-push'></div>
|
73
|
+
</div>
|
74
|
+
<div id='footer'>
|
75
|
+
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
76
|
+
</div>
|
77
|
+
</body>
|
78
|
+
</html>
|
@@ -0,0 +1,193 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>: Elo::Game [elo ]</title>
|
5
|
+
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
+
<link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
+
<script type='text/javascript'>
|
8
|
+
//<![CDATA[
|
9
|
+
function popupCode(url) {
|
10
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
+
}
|
12
|
+
|
13
|
+
function toggleCode(id) {
|
14
|
+
var code = document.getElementById(id)
|
15
|
+
|
16
|
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
|
20
|
+
// Make codeblocks hidden by default
|
21
|
+
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
+
//]]>
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body class='page'>
|
26
|
+
<div class='class' id='wrapper'>
|
27
|
+
<div class='header'>
|
28
|
+
<h1 class='name'>
|
29
|
+
<span class='type'>Class</span>
|
30
|
+
Elo::Game
|
31
|
+
</h1>
|
32
|
+
<ol class='paths'>
|
33
|
+
<li>
|
34
|
+
<a href="../../files/lib/elo_rb.html">lib/elo.rb</a>
|
35
|
+
</li>
|
36
|
+
</ol>
|
37
|
+
<div class='parent'>
|
38
|
+
Parent:
|
39
|
+
<strong>Object</strong>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
<div id='content'>
|
43
|
+
<div id='text'>
|
44
|
+
<div id='method-list'>
|
45
|
+
<h2>Methods</h2>
|
46
|
+
<h3>public instance</h3>
|
47
|
+
<ol>
|
48
|
+
<li><a href="#M000027">draw</a></li>
|
49
|
+
<li><a href="#M000026">lose</a></li>
|
50
|
+
<li><a href="#M000030">loser=</a></li>
|
51
|
+
<li><a href="#M000031">new_rating</a></li>
|
52
|
+
<li><a href="#M000024">result=</a></li>
|
53
|
+
<li><a href="#M000028">save</a></li>
|
54
|
+
<li><a href="#M000025">win</a></li>
|
55
|
+
<li><a href="#M000029">winner=</a></li>
|
56
|
+
</ol>
|
57
|
+
</div>
|
58
|
+
<div id='context'>
|
59
|
+
<div id='includes'>
|
60
|
+
<h2>Included modules</h2>
|
61
|
+
<ol>
|
62
|
+
<li><a href="EloHelper.html">EloHelper</a></li>
|
63
|
+
</ol>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
<div id='section'>
|
67
|
+
<div id='methods'>
|
68
|
+
<h2>Public instance methods</h2>
|
69
|
+
<div class='method public-instance' id='method-M000027'>
|
70
|
+
<a name='M000027'></a>
|
71
|
+
<div class='synopsis'>
|
72
|
+
<span class='name'>draw</span>
|
73
|
+
<span class='arguments'>()</span>
|
74
|
+
</div>
|
75
|
+
<div class='source'>
|
76
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000027-source'); return false">
|
77
|
+
[show source]
|
78
|
+
</a>
|
79
|
+
<pre id='M000027-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 229</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw</span>
 <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>
 <span class="ruby-keyword kw">end</span></pre>
|
80
|
+
</div>
|
81
|
+
</div>
|
82
|
+
<div class='method public-instance' id='method-M000026'>
|
83
|
+
<a name='M000026'></a>
|
84
|
+
<div class='synopsis'>
|
85
|
+
<span class='name'>lose</span>
|
86
|
+
<span class='arguments'>()</span>
|
87
|
+
</div>
|
88
|
+
<div class='source'>
|
89
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000026-source'); return false">
|
90
|
+
[show source]
|
91
|
+
</a>
|
92
|
+
<pre id='M000026-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 225</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lose</span>
 <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>
 <span class="ruby-keyword kw">end</span></pre>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class='method public-instance' id='method-M000030'>
|
96
|
+
<a name='M000030'></a>
|
97
|
+
<div class='synopsis'>
|
98
|
+
<span class='name'>loser=</span>
|
99
|
+
<span class='arguments'>(player)</span>
|
100
|
+
</div>
|
101
|
+
<div class='source'>
|
102
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000030-source'); return false">
|
103
|
+
[show source]
|
104
|
+
</a>
|
105
|
+
<pre id='M000030-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 241</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">loser=</span>(<span class="ruby-identifier">player</span>)
 <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>)
 <span class="ruby-keyword kw">end</span></pre>
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
<div class='method public-instance' id='method-M000031'>
|
109
|
+
<a name='M000031'></a>
|
110
|
+
<div class='synopsis'>
|
111
|
+
<span class='name'>new_rating</span>
|
112
|
+
<span class='arguments'>(player)</span>
|
113
|
+
</div>
|
114
|
+
<div class='source'>
|
115
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000031-source'); return false">
|
116
|
+
[show source]
|
117
|
+
</a>
|
118
|
+
<pre id='M000031-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 245</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_rating</span>(<span class="ruby-identifier">player</span>)
 <span class="ruby-identifier">ratings</span>[<span class="ruby-identifier">player</span>].<span class="ruby-identifier">new_rating</span>
 <span class="ruby-keyword kw">end</span></pre>
|
119
|
+
</div>
|
120
|
+
</div>
|
121
|
+
<div class='method public-instance' id='method-M000024'>
|
122
|
+
<a name='M000024'></a>
|
123
|
+
<div class='synopsis'>
|
124
|
+
<span class='name'>result=</span>
|
125
|
+
<span class='arguments'>(result)</span>
|
126
|
+
</div>
|
127
|
+
<div class='description'>
|
128
|
+
<p>
|
129
|
+
Result is from the perspective of player one.
|
130
|
+
</p>
|
131
|
+
</div>
|
132
|
+
<div class='source'>
|
133
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000024-source'); return false">
|
134
|
+
[show source]
|
135
|
+
</a>
|
136
|
+
<pre id='M000024-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 214</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">result=</span>(<span class="ruby-identifier">result</span>)
 <span class="ruby-ivar">@result</span> = <span class="ruby-identifier">result</span>
 <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>)
 <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>)
 <span class="ruby-identifier">save</span>
 <span class="ruby-keyword kw">end</span></pre>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
<div class='method public-instance' id='method-M000028'>
|
140
|
+
<a name='M000028'></a>
|
141
|
+
<div class='synopsis'>
|
142
|
+
<span class='name'>save</span>
|
143
|
+
<span class='arguments'>()</span>
|
144
|
+
</div>
|
145
|
+
<div class='description'>
|
146
|
+
<p>
|
147
|
+
TODO
|
148
|
+
</p>
|
149
|
+
</div>
|
150
|
+
<div class='source'>
|
151
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000028-source'); return false">
|
152
|
+
[show source]
|
153
|
+
</a>
|
154
|
+
<pre id='M000028-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 234</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>
 <span class="ruby-keyword kw">end</span></pre>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
<div class='method public-instance' id='method-M000025'>
|
158
|
+
<a name='M000025'></a>
|
159
|
+
<div class='synopsis'>
|
160
|
+
<span class='name'>win</span>
|
161
|
+
<span class='arguments'>()</span>
|
162
|
+
</div>
|
163
|
+
<div class='source'>
|
164
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000025-source'); return false">
|
165
|
+
[show source]
|
166
|
+
</a>
|
167
|
+
<pre id='M000025-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 221</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">win</span>
 <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">result</span> = <span class="ruby-value">1.0</span>
 <span class="ruby-keyword kw">end</span></pre>
|
168
|
+
</div>
|
169
|
+
</div>
|
170
|
+
<div class='method public-instance' id='method-M000029'>
|
171
|
+
<a name='M000029'></a>
|
172
|
+
<div class='synopsis'>
|
173
|
+
<span class='name'>winner=</span>
|
174
|
+
<span class='arguments'>(player)</span>
|
175
|
+
</div>
|
176
|
+
<div class='source'>
|
177
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000029-source'); return false">
|
178
|
+
[show source]
|
179
|
+
</a>
|
180
|
+
<pre id='M000029-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 237</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">winner=</span>(<span class="ruby-identifier">player</span>)
 <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>)
 <span class="ruby-keyword kw">end</span></pre>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
</div>
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
<div id='footer-push'></div>
|
188
|
+
</div>
|
189
|
+
<div id='footer'>
|
190
|
+
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
191
|
+
</div>
|
192
|
+
</body>
|
193
|
+
</html>
|
@@ -0,0 +1,254 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>: Elo::Player [elo ]</title>
|
5
|
+
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>
|
6
|
+
<link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
+
<script type='text/javascript'>
|
8
|
+
//<![CDATA[
|
9
|
+
function popupCode(url) {
|
10
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
+
}
|
12
|
+
|
13
|
+
function toggleCode(id) {
|
14
|
+
var code = document.getElementById(id)
|
15
|
+
|
16
|
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
|
20
|
+
// Make codeblocks hidden by default
|
21
|
+
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
+
//]]>
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body class='page'>
|
26
|
+
<div class='class' id='wrapper'>
|
27
|
+
<div class='header'>
|
28
|
+
<h1 class='name'>
|
29
|
+
<span class='type'>Class</span>
|
30
|
+
Elo::Player
|
31
|
+
</h1>
|
32
|
+
<ol class='paths'>
|
33
|
+
<li>
|
34
|
+
<a href="../../files/lib/elo_rb.html">lib/elo.rb</a>
|
35
|
+
</li>
|
36
|
+
</ol>
|
37
|
+
<div class='parent'>
|
38
|
+
Parent:
|
39
|
+
<strong>Object</strong>
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
<div id='content'>
|
43
|
+
<div id='text'>
|
44
|
+
<div id='description'>
|
45
|
+
<p>
|
46
|
+
A player. You need at least two play a <a href="Game.html">Game</a>.
|
47
|
+
</p>
|
48
|
+
</div>
|
49
|
+
<div id='method-list'>
|
50
|
+
<h2>Methods</h2>
|
51
|
+
<h3>public instance</h3>
|
52
|
+
<ol>
|
53
|
+
<li><a href="#M000009">games</a></li>
|
54
|
+
<li><a href="#M000008">games_played</a></li>
|
55
|
+
<li><a href="#M000014">k_factor</a></li>
|
56
|
+
<li><a href="#M000018">loses_from</a></li>
|
57
|
+
<li><a href="#M000017">plays_draw</a></li>
|
58
|
+
<li><a href="#M000012">pro?</a></li>
|
59
|
+
<li><a href="#M000010">pro_rating?</a></li>
|
60
|
+
<li><a href="#M000007">rating</a></li>
|
61
|
+
<li><a href="#M000013">save</a></li>
|
62
|
+
<li><a href="#M000011">starter?</a></li>
|
63
|
+
<li><a href="#M000015">versus</a></li>
|
64
|
+
<li><a href="#M000016">wins_from</a></li>
|
65
|
+
</ol>
|
66
|
+
</div>
|
67
|
+
<div id='context'>
|
68
|
+
<div id='includes'>
|
69
|
+
<h2>Included modules</h2>
|
70
|
+
<ol>
|
71
|
+
<li><a href="EloHelper.html">EloHelper</a></li>
|
72
|
+
</ol>
|
73
|
+
</div>
|
74
|
+
</div>
|
75
|
+
<div id='section'>
|
76
|
+
<div id='methods'>
|
77
|
+
<h2>Public instance methods</h2>
|
78
|
+
<div class='method public-instance' id='method-M000009'>
|
79
|
+
<a name='M000009'></a>
|
80
|
+
<div class='synopsis'>
|
81
|
+
<span class='name'>games</span>
|
82
|
+
<span class='arguments'>()</span>
|
83
|
+
</div>
|
84
|
+
<div class='source'>
|
85
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
|
86
|
+
[show source]
|
87
|
+
</a>
|
88
|
+
<pre id='M000009-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 146</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">games</span>
 <span class="ruby-ivar">@games</span> <span class="ruby-operator">||=</span> []
 <span class="ruby-keyword kw">end</span></pre>
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
<div class='method public-instance' id='method-M000008'>
|
92
|
+
<a name='M000008'></a>
|
93
|
+
<div class='synopsis'>
|
94
|
+
<span class='name'>games_played</span>
|
95
|
+
<span class='arguments'>()</span>
|
96
|
+
</div>
|
97
|
+
<div class='source'>
|
98
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000008-source'); return false">
|
99
|
+
[show source]
|
100
|
+
</a>
|
101
|
+
<pre id='M000008-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 142</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">games_played</span>
 <span class="ruby-ivar">@games_played</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">games</span>.<span class="ruby-identifier">size</span>
 <span class="ruby-keyword kw">end</span></pre>
|
102
|
+
</div>
|
103
|
+
</div>
|
104
|
+
<div class='method public-instance' id='method-M000014'>
|
105
|
+
<a name='M000014'></a>
|
106
|
+
<div class='synopsis'>
|
107
|
+
<span class='name'>k_factor</span>
|
108
|
+
<span class='arguments'>()</span>
|
109
|
+
</div>
|
110
|
+
<div class='source'>
|
111
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
|
112
|
+
[show source]
|
113
|
+
</a>
|
114
|
+
<pre id='M000014-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 168</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">k_factor</span>
 <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>
 <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">&</span><span class="ruby-identifier">rule</span>[<span class="ruby-identifier">:rule</span>])
 <span class="ruby-keyword kw">end</span>
 <span class="ruby-constant">Elo</span>.<span class="ruby-identifier">default_k_factor</span>
 <span class="ruby-keyword kw">end</span></pre>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class='method public-instance' id='method-M000018'>
|
118
|
+
<a name='M000018'></a>
|
119
|
+
<div class='synopsis'>
|
120
|
+
<span class='name'>loses_from</span>
|
121
|
+
<span class='arguments'>(other_player)</span>
|
122
|
+
</div>
|
123
|
+
<div class='source'>
|
124
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
|
125
|
+
[show source]
|
126
|
+
</a>
|
127
|
+
<pre id='M000018-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 187</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">loses_from</span>(<span class="ruby-identifier">other_player</span>)
 <span class="ruby-identifier">versus</span>(<span class="ruby-identifier">other_player</span>).<span class="ruby-identifier">lose</span>
 <span class="ruby-keyword kw">end</span></pre>
|
128
|
+
</div>
|
129
|
+
</div>
|
130
|
+
<div class='method public-instance' id='method-M000017'>
|
131
|
+
<a name='M000017'></a>
|
132
|
+
<div class='synopsis'>
|
133
|
+
<span class='name'>plays_draw</span>
|
134
|
+
<span class='arguments'>(other_player)</span>
|
135
|
+
</div>
|
136
|
+
<div class='source'>
|
137
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
|
138
|
+
[show source]
|
139
|
+
</a>
|
140
|
+
<pre id='M000017-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 183</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">plays_draw</span>(<span class="ruby-identifier">other_player</span>)
 <span class="ruby-identifier">versus</span>(<span class="ruby-identifier">other_player</span>).<span class="ruby-identifier">draw</span>
 <span class="ruby-keyword kw">end</span></pre>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
<div class='method public-instance' id='method-M000012'>
|
144
|
+
<a name='M000012'></a>
|
145
|
+
<div class='synopsis'>
|
146
|
+
<span class='name'>pro?</span>
|
147
|
+
<span class='arguments'>()</span>
|
148
|
+
</div>
|
149
|
+
<div class='source'>
|
150
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
|
151
|
+
[show source]
|
152
|
+
</a>
|
153
|
+
<pre id='M000012-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 158</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pro?</span>
 <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-ivar">@pro</span>
 <span class="ruby-keyword kw">end</span></pre>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
<div class='method public-instance' id='method-M000010'>
|
157
|
+
<a name='M000010'></a>
|
158
|
+
<div class='synopsis'>
|
159
|
+
<span class='name'>pro_rating?</span>
|
160
|
+
<span class='arguments'>()</span>
|
161
|
+
</div>
|
162
|
+
<div class='source'>
|
163
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
|
164
|
+
[show source]
|
165
|
+
</a>
|
166
|
+
<pre id='M000010-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 150</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pro_rating?</span>
 <span class="ruby-identifier">rating</span> <span class="ruby-operator">></span> <span class="ruby-constant">Elo</span>.<span class="ruby-identifier">pro_rating_boundry</span>
 <span class="ruby-keyword kw">end</span></pre>
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
<div class='method public-instance' id='method-M000007'>
|
170
|
+
<a name='M000007'></a>
|
171
|
+
<div class='synopsis'>
|
172
|
+
<span class='name'>rating</span>
|
173
|
+
<span class='arguments'>()</span>
|
174
|
+
</div>
|
175
|
+
<div class='description'>
|
176
|
+
<p>
|
177
|
+
<a href="Rating.html">Rating</a>
|
178
|
+
</p>
|
179
|
+
</div>
|
180
|
+
<div class='source'>
|
181
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000007-source'); return false">
|
182
|
+
[show source]
|
183
|
+
</a>
|
184
|
+
<pre id='M000007-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 138</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rating</span>
 <span class="ruby-ivar">@rating</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Elo</span>.<span class="ruby-identifier">default_rating</span>
 <span class="ruby-keyword kw">end</span></pre>
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
<div class='method public-instance' id='method-M000013'>
|
188
|
+
<a name='M000013'></a>
|
189
|
+
<div class='synopsis'>
|
190
|
+
<span class='name'>save</span>
|
191
|
+
<span class='arguments'>()</span>
|
192
|
+
</div>
|
193
|
+
<div class='description'>
|
194
|
+
<p>
|
195
|
+
TODO
|
196
|
+
</p>
|
197
|
+
</div>
|
198
|
+
<div class='source'>
|
199
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
|
200
|
+
[show source]
|
201
|
+
</a>
|
202
|
+
<pre id='M000013-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 163</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>
 <span class="ruby-comment cmt"># hook for your own model</span>
 <span class="ruby-comment cmt"># which I don't know yet how to do</span>
 <span class="ruby-keyword kw">end</span></pre>
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
<div class='method public-instance' id='method-M000011'>
|
206
|
+
<a name='M000011'></a>
|
207
|
+
<div class='synopsis'>
|
208
|
+
<span class='name'>starter?</span>
|
209
|
+
<span class='arguments'>()</span>
|
210
|
+
</div>
|
211
|
+
<div class='source'>
|
212
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
|
213
|
+
[show source]
|
214
|
+
</a>
|
215
|
+
<pre id='M000011-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 154</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">starter?</span>
 <span class="ruby-identifier">games_played</span> <span class="ruby-operator"><</span> <span class="ruby-constant">Elo</span>.<span class="ruby-identifier">starter_boundry</span>
 <span class="ruby-keyword kw">end</span></pre>
|
216
|
+
</div>
|
217
|
+
</div>
|
218
|
+
<div class='method public-instance' id='method-M000015'>
|
219
|
+
<a name='M000015'></a>
|
220
|
+
<div class='synopsis'>
|
221
|
+
<span class='name'>versus</span>
|
222
|
+
<span class='arguments'>(other_player)</span>
|
223
|
+
</div>
|
224
|
+
<div class='source'>
|
225
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
|
226
|
+
[show source]
|
227
|
+
</a>
|
228
|
+
<pre id='M000015-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 175</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">versus</span>(<span class="ruby-identifier">other_player</span>)
 <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:one</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">:two</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">other_player</span>)
 <span class="ruby-keyword kw">end</span></pre>
|
229
|
+
</div>
|
230
|
+
</div>
|
231
|
+
<div class='method public-instance' id='method-M000016'>
|
232
|
+
<a name='M000016'></a>
|
233
|
+
<div class='synopsis'>
|
234
|
+
<span class='name'>wins_from</span>
|
235
|
+
<span class='arguments'>(other_player)</span>
|
236
|
+
</div>
|
237
|
+
<div class='source'>
|
238
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
|
239
|
+
[show source]
|
240
|
+
</a>
|
241
|
+
<pre id='M000016-source'><span class="ruby-comment cmt"># File lib/elo.rb, line 179</span>
 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wins_from</span>(<span class="ruby-identifier">other_player</span>)
 <span class="ruby-identifier">versus</span>(<span class="ruby-identifier">other_player</span>).<span class="ruby-identifier">win</span>
 <span class="ruby-keyword kw">end</span></pre>
|
242
|
+
</div>
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
</div>
|
246
|
+
</div>
|
247
|
+
</div>
|
248
|
+
<div id='footer-push'></div>
|
249
|
+
</div>
|
250
|
+
<div id='footer'>
|
251
|
+
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
252
|
+
</div>
|
253
|
+
</body>
|
254
|
+
</html>
|