Created
May 7, 2015 15:41
-
-
Save Noxville/249fa126e72c6ef28eb3 to your computer and use it in GitHub Desktop.
Elo Calculation Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final static double K_WEIGHTING = 64.0 | |
final static double MEAN_RATING = 1000.0 | |
def newRadElo = calculateElo(radElo, direElo, (winner == "Radiant")) | |
def newDireElo = calculateElo(direElo, radElo, (winner == "Dire")) | |
double calculateElo(Elo thisTeam, Elo otherTeam, boolean win) { | |
double diff = (win ? 1.0 : -1.0) * (thisTeam.rating - otherTeam.rating) / 400.00 | |
double _d = 1.0 / (1.0 + Math.pow(10.0, diff)) | |
double _e = K_WEIGHTING * _d | |
return win ? thisTeam.rating + _e : thisTeam.rating - _e | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment