diff --git a/modules/rating/src/main/java/glicko2/Rating.java b/modules/rating/src/main/java/glicko2/Rating.java index 2d0daec399..78587a1de6 100644 --- a/modules/rating/src/main/java/glicko2/Rating.java +++ b/modules/rating/src/main/java/glicko2/Rating.java @@ -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); } diff --git a/modules/rating/src/main/java/glicko2/RatingCalculator.java b/modules/rating/src/main/java/glicko2/RatingCalculator.java index f740991b0e..0e012e14f7 100644 --- a/modules/rating/src/main/java/glicko2/RatingCalculator.java +++ b/modules/rating/src/main/java/glicko2/RatingCalculator.java @@ -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() )) ); } diff --git a/modules/round/src/main/PerfsUpdater.scala b/modules/round/src/main/PerfsUpdater.scala index 1c84260c8c..1db94ccc62 100644 --- a/modules/round/src/main/PerfsUpdater.scala +++ b/modules/round/src/main/PerfsUpdater.scala @@ -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)