Revert "Ratings - account for first player advantage #6818"

This reverts commit 34d775c73d.
pull/8310/head
Thibault Duplessis 2021-03-04 08:08:42 +01:00
parent 3d019b77e4
commit c7d3b9f60c
3 changed files with 11 additions and 40 deletions

View File

@ -19,7 +19,6 @@ import org.joda.time.DateTime;
*/
public class Rating {
private final double advantage;
private double rating;
private double ratingDeviation;
private double volatility;
@ -32,15 +31,10 @@ public class Rating {
private double workingVolatility;
public Rating(double initRating, double initRatingDeviation, double initVolatility, int nbResults) {
this(0.0d, initRating, initRatingDeviation, initVolatility, nbResults, null);
this(initRating, initRatingDeviation, initVolatility, nbResults, null);
}
public Rating(double initRating, double initRatingDeviation, double initVolatility, int nbResults, DateTime lastRatingPeriodEndDate) {
this(0.0d, initRating, initRatingDeviation, initVolatility, nbResults, lastRatingPeriodEndDate);
}
public Rating(double advantage, double initRating, double initRatingDeviation, double initVolatility, int nbResults, DateTime lastRatingPeriodEndDate) {
this.advantage = advantage;
this.rating = initRating;
this.ratingDeviation = initRatingDeviation;
this.volatility = initVolatility;
@ -48,19 +42,6 @@ public class Rating {
this.lastRatingPeriodEndDate = lastRatingPeriodEndDate;
}
public Rating withAdvantage(double advantage) {
return new Rating(advantage, rating, ratingDeviation, volatility, numberOfResults, lastRatingPeriodEndDate);
}
/**
* Return the skill advantage (first-player handicap) value.
*
* @return double
*/
public double getAdvantage() {
return this.advantage;
}
/**
* Return the average skill value of the player.
*
@ -74,16 +55,6 @@ public class Rating {
this.rating = rating;
}
/**
* Return the average skill value of the player scaled down
* to the scale used by the algorithm's internal workings.
*
* @return double
*/
public double getGlicko2RatingWithAdvantage() {
return RatingCalculator.convertRatingToGlicko2Scale(this.rating + advantage);
}
/**
* Return the average skill value of the player scaled down
* to the scale used by the algorithm's internal workings.
@ -99,7 +70,7 @@ public class Rating {
*
* @param double
*/
private void setGlicko2Rating(double rating) {
public void setGlicko2Rating(double rating) {
this.rating = RatingCalculator.convertRatingToOriginalGlickoScale(rating);
}

View File

@ -254,11 +254,11 @@ public class RatingCalculator {
for ( Result result: results ) {
v = v + (
( Math.pow( g(result.getOpponent(player).getGlicko2RatingDeviation()), 2) )
* E(player.getGlicko2RatingWithAdvantage(),
result.getOpponent(player).getGlicko2RatingWithAdvantage(),
* E(player.getGlicko2Rating(),
result.getOpponent(player).getGlicko2Rating(),
result.getOpponent(player).getGlicko2RatingDeviation())
* ( 1.0 - E(player.getGlicko2RatingWithAdvantage(),
result.getOpponent(player).getGlicko2RatingWithAdvantage(),
* ( 1.0 - E(player.getGlicko2Rating(),
result.getOpponent(player).getGlicko2Rating(),
result.getOpponent(player).getGlicko2RatingDeviation())
));
}
@ -293,8 +293,8 @@ public class RatingCalculator {
outcomeBasedRating = outcomeBasedRating
+ ( g(result.getOpponent(player).getGlicko2RatingDeviation())
* ( result.getScore(player) - E(
player.getGlicko2RatingWithAdvantage(),
result.getOpponent(player).getGlicko2RatingWithAdvantage(),
player.getGlicko2Rating(),
result.getOpponent(player).getGlicko2Rating(),
result.getOpponent(player).getGlicko2RatingDeviation() ))
);
}

View File

@ -124,9 +124,9 @@ final class PerfsUpdater(
private def updateRatings(white: Rating, black: Rating, result: Glicko.Result): Unit = {
val results = new RatingPeriodResults()
result match {
case Glicko.Result.Draw => results.addDraw(white.withAdvantage(5), black.withAdvantage(-5))
case Glicko.Result.Win => results.addResult(white.withAdvantage(5), black.withAdvantage(-5))
case Glicko.Result.Loss => results.addResult(black.withAdvantage(-5), white.withAdvantage(5))
case Glicko.Result.Draw => results.addDraw(white, black)
case Glicko.Result.Win => results.addResult(white, black)
case Glicko.Result.Loss => results.addResult(black, white)
}
try {
Glicko.system.updateRatings(results, true)