skip glicko calculation when the game result is obvious
parent
63ab3e23aa
commit
64ebba75c7
|
@ -114,6 +114,13 @@ final class PerfsUpdater(
|
|||
)
|
||||
|
||||
private def updateRatings(white: Rating, black: Rating, game: Game): Unit = {
|
||||
// if the winner is rated more than 500 higher, leave both ratings untouched.
|
||||
// this helps prevent farming and keeping deviation low by playing 1500? players
|
||||
val isObviousResult = game.winnerColor.?? {
|
||||
case chess.White => white.getRating - black.getRating
|
||||
case chess.Black => black.getRating - white.getRating
|
||||
} > 500
|
||||
if (!isObviousResult) {
|
||||
val result = game.winnerColor match {
|
||||
case Some(chess.White) => Glicko.Result.Win
|
||||
case Some(chess.Black) => Glicko.Result.Loss
|
||||
|
@ -131,6 +138,7 @@ final class PerfsUpdater(
|
|||
case e: Exception => logger.error(s"update ratings #${game.id}", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def mkPerfs(ratings: Ratings, users: (User, User), game: Game): Perfs =
|
||||
users match {
|
||||
|
|
Loading…
Reference in New Issue