Added in kFactor ratio application to rating delta.

This commit is contained in:
Jonathan Williams 2016-04-22 02:35:37 -05:00
parent b69a75355c
commit 757c945320
2 changed files with 10 additions and 2 deletions

View File

@ -42,9 +42,17 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
{ {
EloTeam newTeam = new EloTeam(); 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()) 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); EloPlayer newPlayer = new EloPlayer(player.getPlayer(), newRating);
newTeam.addPlayer(newPlayer); newTeam.addPlayer(newPlayer);

View File

@ -57,7 +57,7 @@ public class EloRatingSystem
return oldRating + (int) (kFactor * (score - expectedScore)); return oldRating + (int) (kFactor * (score - expectedScore));
} }
private double getKFactor(int rating) double getKFactor(int rating)
{ {
for (int i = 0; i < _kFactors.length; i++) for (int i = 0; i < _kFactors.length; i++)
{ {