mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
method name mistype fix (cound -> count)
This commit is contained in:
parent
55957f17a0
commit
c15a59b5f8
1 changed files with 4 additions and 5 deletions
|
@ -85,16 +85,15 @@ public class ResultHandler {
|
||||||
String line = s.nextLine();
|
String line = s.nextLine();
|
||||||
Matcher m = scorePattern.matcher(line);
|
Matcher m = scorePattern.matcher(line);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
String winner = m.group(1);
|
String winner = m.group(1);String loser = m.group(2);
|
||||||
String loser = m.group(2);
|
|
||||||
Integer winnerRating = ratings.get(winner);
|
Integer winnerRating = ratings.get(winner);
|
||||||
if (winnerRating == null)
|
if (winnerRating == null)
|
||||||
winnerRating = 1000;
|
winnerRating = 1000;
|
||||||
Integer loserRating = ratings.get(loser);
|
Integer loserRating = ratings.get(loser);
|
||||||
if (loserRating == null)
|
if (loserRating == null)
|
||||||
loserRating = 1000;
|
loserRating = 1000;
|
||||||
Integer newWinnerRating = coundEloRating(winnerRating, loserRating, true);
|
Integer newWinnerRating = countEloRating(winnerRating, loserRating, true);
|
||||||
Integer newLoserRating = coundEloRating(loserRating, winnerRating, false);
|
Integer newLoserRating = countEloRating(loserRating, winnerRating, false);
|
||||||
log.info("Winner(" + winner + "): " + winnerRating + " >> " + newWinnerRating);
|
log.info("Winner(" + winner + "): " + winnerRating + " >> " + newWinnerRating);
|
||||||
log.info("Loser(" + loser + "): " + loserRating + " >> " + newLoserRating);
|
log.info("Loser(" + loser + "): " + loserRating + " >> " + newLoserRating);
|
||||||
ratings.put(winner, newWinnerRating);
|
ratings.put(winner, newWinnerRating);
|
||||||
|
@ -113,7 +112,7 @@ public class ResultHandler {
|
||||||
* @param rb
|
* @param rb
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private Integer coundEloRating(Integer ra, Integer rb, boolean firstWon) {
|
private Integer countEloRating(Integer ra, Integer rb, boolean firstWon) {
|
||||||
double d = (rb - ra) / 400.0;
|
double d = (rb - ra) / 400.0;
|
||||||
double expected = 1.0d / (1 + Math.pow(10, d));
|
double expected = 1.0d / (1 + Math.pow(10, d));
|
||||||
double actual = firstWon ? 1 : 0;
|
double actual = firstWon ? 1 : 0;
|
||||||
|
|
Loading…
Reference in a new issue