wavelength 1.0.0
Loading...
Searching...
No Matches
ratingstat.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
6
15public:
17 static constexpr int kProvisionalGames = 16;
18
26 void Set(const NetLaunchpadPlayer *pPlayer);
27
36 int Rating() const;
37
45 bool IsProvisional() const;
46
60 void Rate(int nId, const std::vector<RatingStat> *pStats);
61
71 static float Outcome(int nScore, int nOpponentScore);
72
81 static float ExpectedScore(int nDifference);
82
92 static float RatingDifference(float fScore);
93
95 static constexpr int kDifferenceCount = 51;
96
104
106 int GetGames() const {
107 return mGames;
108 }
109
111 int GetId() const {
112 return mId;
113 }
114
116 int GetOpponents() const {
117 return mOpponents;
118 }
119
121 int GetPoints() const {
122 return mPoints;
123 }
124
126 int GetRating() const {
127 return mRating;
128 }
129
131 void SetScore(int nScore) {
132 mScore = nScore;
133 }
134
136 float GetWins() const {
137 return mWins;
138 }
139
140private:
141 int mId;
142 int mRating;
143 int mGames;
144 int mOpponents;
145 float mWins;
146 int mPoints;
147 int mScore;
148};
The rating of one player of an online game, and the results that rate the player afterwards.
Definition ratingstat.h:14
float GetWins() const
Definition ratingstat.h:136
int GetGames() const
Definition ratingstat.h:106
int Rating() const
Report the rating without the bonus of a player past the first games.
static constexpr int kDifferenceCount
The number of entries of sDifferences.
Definition ratingstat.h:95
static float ExpectedScore(int nDifference)
Report the score a player expects against an opponent from the difference of the ratings.
int GetId() const
Definition ratingstat.h:111
static int sDifferences[kDifferenceCount]
The differences of ratings that make a player expect scores of 0.5, 0.51, and so on to 1.
Definition ratingstat.h:103
int GetRating() const
Definition ratingstat.h:126
int GetPoints() const
Definition ratingstat.h:121
int GetOpponents() const
Definition ratingstat.h:116
void SetScore(int nScore)
Definition ratingstat.h:131
void Set(const NetLaunchpadPlayer *pPlayer)
Copy the identifier, the rating, and the record of a player of the session.
static constexpr int kProvisionalGames
The games below which a player's rating comes from the average of the opponents.
Definition ratingstat.h:17
void Rate(int nId, const std::vector< RatingStat > *pStats)
Rate a player from the scores of a game.
static float RatingDifference(float fScore)
Report the difference of ratings that makes a player expect a score, inverting ExpectedScore() by int...
bool IsProvisional() const
Report whether the player has played fewer than kProvisionalGames games.
static float Outcome(int nScore, int nOpponentScore)
Report the outcome of a game for a player.
The description of one player of the online session this console is in.
Definition netlaunchpadplayer.h:13