Cute Chess  0.1
elo.h
1 /*
2  This file is part of Cute Chess.
3 
4  Cute Chess is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  Cute Chess is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
16 */
17 
18 #ifndef ELO_H
19 #define ELO_H
20 
21 #include <QtGlobal>
22 
32 class LIB_EXPORT Elo
33 {
34  public:
36  Elo(int wins, int losses, int draws);
37 
39  qreal diff() const;
41  qreal errorMargin() const;
43  qreal pointRatio() const;
45  qreal drawRatio() const;
46 
47  private:
48  int m_wins;
49  int m_losses;
50  int m_draws;
51  qreal m_mu;
52  qreal m_stdev;
53 
54  // Elo difference
55  qreal diff(qreal p) const;
56  // Inverted error function
57  qreal erfInv(qreal x) const;
58  // Quantile function for the standard Gaussian law:
59  // probability -> quantile
60  qreal phiInv(qreal p) const;
61 };
62 
63 #endif // ELO_H
Utility class for calculating Elo statistics for a single player.
Definition: elo.h:32