1
- #include < matchmaking/elo/elo_norm .hpp>
1
+ #include < matchmaking/elo/elo_pentanomial .hpp>
2
2
3
3
#include < cmath>
4
4
#include < iomanip>
5
5
#include < sstream>
6
6
7
7
namespace fast_chess {
8
8
9
- EloNormalized::EloNormalized (const Stats& stats) {
9
+ EloPentanomial::EloPentanomial (const Stats& stats) {
10
10
diff_ = diff (stats);
11
11
error_ = error (stats);
12
12
nelodiff_ = nEloDiff (stats);
13
13
neloerror_ = nEloError (stats);
14
14
}
15
15
16
- double EloNormalized ::percToEloDiff (double percentage) noexcept {
16
+ double EloPentanomial ::percToEloDiff (double percentage) noexcept {
17
17
return -400.0 * std::log10 (1.0 / percentage - 1.0 );
18
18
}
19
19
20
- double EloNormalized ::percToNeloDiff (double percentage, double stdev) noexcept {
20
+ double EloPentanomial ::percToNeloDiff (double percentage, double stdev) noexcept {
21
21
return (percentage - 0.5 ) / (std::sqrt (2 ) * stdev) * (800 / std::log (10 ));
22
22
}
23
23
24
- double EloNormalized ::percToNeloDiffWDL (double percentage, double stdev) noexcept {
24
+ double EloPentanomial ::percToNeloDiffWDL (double percentage, double stdev) noexcept {
25
25
return (percentage - 0.5 ) / stdev * (800 / std::log (10 ));
26
26
}
27
27
28
- double EloNormalized ::error (const Stats& stats) noexcept {
28
+ double EloPentanomial ::error (const Stats& stats) noexcept {
29
29
const double pairs = total (stats);
30
30
const double WW = double (stats.penta_WW ) / pairs;
31
31
const double WD = double (stats.penta_WD ) / pairs;
@@ -46,7 +46,7 @@ double EloNormalized::error(const Stats& stats) noexcept {
46
46
return (percToEloDiff (devMax) - percToEloDiff (devMin)) / 2.0 ;
47
47
}
48
48
49
- double EloNormalized ::nEloError (const Stats& stats) noexcept {
49
+ double EloPentanomial ::nEloError (const Stats& stats) noexcept {
50
50
const double pairs = total (stats);
51
51
const double WW = double (stats.penta_WW ) / pairs;
52
52
const double WD = double (stats.penta_WD ) / pairs;
@@ -69,7 +69,7 @@ double EloNormalized::nEloError(const Stats& stats) noexcept {
69
69
2.0 ;
70
70
}
71
71
72
- double EloNormalized ::diff (const Stats& stats) noexcept {
72
+ double EloPentanomial ::diff (const Stats& stats) noexcept {
73
73
const double pairs = total (stats);
74
74
const double WW = double (stats.penta_WW ) / pairs;
75
75
const double WD = double (stats.penta_WD ) / pairs;
@@ -81,7 +81,7 @@ double EloNormalized::diff(const Stats& stats) noexcept {
81
81
return percToEloDiff (percentage);
82
82
}
83
83
84
- double EloNormalized ::nEloDiff (const Stats& stats) noexcept {
84
+ double EloPentanomial ::nEloDiff (const Stats& stats) noexcept {
85
85
const double pairs = total (stats);
86
86
const double WW = double (stats.penta_WW ) / pairs;
87
87
const double WD = double (stats.penta_WD ) / pairs;
@@ -100,7 +100,7 @@ double EloNormalized::nEloDiff(const Stats& stats) noexcept {
100
100
return percToNeloDiff (a, stdev * std::sqrt (pairs));
101
101
}
102
102
103
- std::string EloNormalized ::nElo () const noexcept {
103
+ std::string EloPentanomial ::nElo () const noexcept {
104
104
std::stringstream ss;
105
105
106
106
ss << std::fixed << std::setprecision (2 ) << nelodiff_;
@@ -109,7 +109,7 @@ std::string EloNormalized::nElo() const noexcept {
109
109
return ss.str ();
110
110
}
111
111
112
- std::string EloNormalized ::los (const Stats& stats) const noexcept {
112
+ std::string EloPentanomial ::los (const Stats& stats) const noexcept {
113
113
const double pairs = total (stats);
114
114
const double WW = double (stats.penta_WW ) / pairs;
115
115
const double WD = double (stats.penta_WD ) / pairs;
@@ -131,15 +131,15 @@ std::string EloNormalized::los(const Stats& stats) const noexcept {
131
131
return ss.str ();
132
132
}
133
133
134
- std::string EloNormalized ::drawRatio (const Stats& stats) const noexcept {
134
+ std::string EloPentanomial ::drawRatio (const Stats& stats) const noexcept {
135
135
const double pairs = total (stats);
136
136
std::stringstream ss;
137
137
ss << std::fixed << std::setprecision (2 ) << ((stats.penta_WL + stats.penta_DD ) / pairs) * 100.0
138
138
<< " %" ;
139
139
return ss.str ();
140
140
}
141
141
142
- std::string EloNormalized ::scoreRatio (const Stats& stats) const noexcept {
142
+ std::string EloPentanomial ::scoreRatio (const Stats& stats) const noexcept {
143
143
const double pairs = total (stats);
144
144
const double WW = double (stats.penta_WW ) / pairs;
145
145
const double WD = double (stats.penta_WD ) / pairs;
@@ -153,7 +153,7 @@ std::string EloNormalized::scoreRatio(const Stats& stats) const noexcept {
153
153
return ss.str ();
154
154
}
155
155
156
- std::size_t EloNormalized ::total (const Stats& stats) noexcept {
156
+ std::size_t EloPentanomial ::total (const Stats& stats) noexcept {
157
157
return stats.penta_WW + stats.penta_WD + stats.penta_WL + stats.penta_DD + stats.penta_LD +
158
158
stats.penta_LL ;
159
159
}
0 commit comments