Merge branch 'features/elo' of github.com:Mineplex-LLC/Minecraft-PC into alex/elofix

This commit is contained in:
AlexTheCoder 2016-04-22 03:36:21 -04:00
commit 5e255fc4ed
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();
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);

View File

@ -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++)
{