Tweaked elo for team games.

This commit is contained in:
Jonathan Williams 2016-04-22 02:04:57 -05:00
parent 776093288a
commit aa6d25139f

View File

@ -21,12 +21,12 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
_repository = new EloRepository(plugin); _repository = new EloRepository(plugin);
_ratingSystem = new EloRatingSystem _ratingSystem = new EloRatingSystem
( (
new KFactor(0, 1299, 30), new KFactor(0, 1299, 50),
new KFactor(1300, 1899, 25), new KFactor(1300, 1899, 45),
new KFactor(1900, 2499, 20), new KFactor(1900, 2499, 40),
new KFactor(2500, 3099, 15), new KFactor(2500, 3099, 30),
new KFactor(3100, 3699, 10), new KFactor(3100, 3699, 20),
new KFactor(3700, 5000, 5) new KFactor(3700, 5000, 10)
); );
} }
@ -42,11 +42,9 @@ 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) * teamA.getPlayers().size();
for (EloPlayer player : teamA.getPlayers()) for (EloPlayer player : teamA.getPlayers())
{ {
int newRating = (int)(player.getRating() + ((double)player.getRating() / (double)teamA.TotalElo) * (newTotal - teamA.TotalElo)); int newRating = _ratingSystem.getNewRating(player.getRating(), (teamB.TotalElo / teamB.getPlayers().size()), result);
EloPlayer newPlayer = new EloPlayer(player.getPlayer(), newRating); EloPlayer newPlayer = new EloPlayer(player.getPlayer(), newRating);
newTeam.addPlayer(newPlayer); newTeam.addPlayer(newPlayer);