|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.parlor.rating.server.Rating
public class Rating
Encapsulates the rating/experience tuple representing a player's rating for a game, and logic for calculating rating changes.
| Field Summary | |
|---|---|
int |
experience
The number of times the player's played our game. |
int |
rating
The player's rating for our game. |
| Fields inherited from interface com.threerings.parlor.rating.data.RatingCodes |
|---|
DEFAULT_RATING, MAXIMUM_RATING, MINIMUM_RATING |
| Constructor Summary | |
|---|---|
Rating()
|
|
| Method Summary | |
|---|---|
static float |
computeAdjustment(float W,
int opprat,
Rating rating)
Computes a ratings adjustment for the given player, using a modified version of the FIDE Chess rating system as: adjustment = K(W - We) where: K = if (experience < 20) then 64 else if (rating < 2100 and experience >= 20) then 32 else if (rating >= 2100 and rating < 2400 and experience >= 20) then 24 else 16 W = score for the game just completed, as 1.0, 0.5, and 0.0 for a win, draw, or loss, respectively. |
static int |
computeRating(Rating[] ratings,
int pidx,
float W)
Computes a player's updated rating using a modified version of the FIDE/ELO system. |
boolean |
isProvisional()
Returns true if this rating is provisional (experience < 20). |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public int rating
public int experience
| Constructor Detail |
|---|
public Rating()
| Method Detail |
|---|
public static int computeRating(Rating[] ratings,
int pidx,
float W)
ratings - the pre-match ratings of each of the opponents.pidx - the index of the player whose rating is to be calculated.W - the win value for the player whose rating is to be calculated,
(1.0 means the player won, 0.5 means they drew, 0 means they lost).
public static float computeAdjustment(float W,
int opprat,
Rating rating)
adjustment = K(W - We)
where:
K = if (experience < 20) then 64
else if (rating < 2100 and experience >= 20) then 32
else if (rating >= 2100 and rating < 2400 and experience >= 20)
then 24
else 16
W = score for the game just completed, as 1.0, 0.5, and 0.0 for a
win, draw, or loss, respectively.
dR = opponent's rating minus player's rating.
We = expected score (win expectancy) as determined by:
We = 1 / (10^(dR/400) + 1)
W - the win value the game in question (1.0 means the player won,
0.5 means they drew, 0 means they lost).opprat - the opponent's current rating.rating - the player's current rating.
public boolean isProvisional()
public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||