From 757c94532033e882e85d2803f0a1a6427030f63a Mon Sep 17 00:00:00 2001 From: Jonathan Williams Date: Fri, 22 Apr 2016 02:35:37 -0500 Subject: [PATCH] Added in kFactor ratio application to rating delta. --- .../src/mineplex/core/elo/EloManager.java | 10 +++++++++- .../src/mineplex/core/elo/EloRatingSystem.java | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java index 96de85bbb..2c06b4644 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloManager.java @@ -42,9 +42,17 @@ public class EloManager extends MiniDbClientPlugin { EloTeam newTeam = new EloTeam(); + int newTotal = _ratingSystem.getNewRating(teamA.TotalElo / teamA.getPlayers().size(), teamB.TotalElo / teamB.getPlayers().size(), result); + int kTotal = 0; + for (EloPlayer player : teamA.getPlayers()) { - int newRating = _ratingSystem.getNewRating(player.getRating(), (teamB.TotalElo / teamB.getPlayers().size()), result); + kTotal += _ratingSystem.getKFactor(player.getRating()); + } + + for (EloPlayer player : teamA.getPlayers()) + { + int newRating = (int)(player.getRating() + ((double)_ratingSystem.getKFactor(player.getRating()) / (double)kTotal) * (newTotal - teamA.TotalElo)); EloPlayer newPlayer = new EloPlayer(player.getPlayer(), newRating); newTeam.addPlayer(newPlayer); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRatingSystem.java b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRatingSystem.java index d32433ed6..cb18341cc 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRatingSystem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/elo/EloRatingSystem.java @@ -57,7 +57,7 @@ public class EloRatingSystem return oldRating + (int) (kFactor * (score - expectedScore)); } - private double getKFactor(int rating) + double getKFactor(int rating) { for (int i = 0; i < _kFactors.length; i++) {