Skip to content

Commit

Permalink
Rename GameResult to DuelResult
Browse files Browse the repository at this point in the history
  • Loading branch information
ddugovic committed Oct 31, 2024
1 parent ef02272 commit d31bc4a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion modules/rating/src/main/glicko2/RatingPeriodResults.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ trait RatingPeriodResults[R <: Result]():
final class BinaryRatingPeriodResults(val results: List[BinaryResult])
extends RatingPeriodResults[BinaryResult]

final class GameRatingPeriodResults(val results: List[GameResult]) extends RatingPeriodResults[GameResult]
final class GameRatingPeriodResults(val results: List[DuelResult]) extends RatingPeriodResults[DuelResult]
2 changes: 1 addition & 1 deletion modules/rating/src/main/glicko2/Result.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class BinaryResult(val first: Rating, val second: Rating, score: Boolean)
else if score then POINTS_FOR_LOSS
else POINTS_FOR_WIN

final class GameResult(val first: Rating, val second: Rating, outcome: Option[Boolean]) extends Result:
final class DuelResult(val first: Rating, val second: Rating, outcome: Option[Boolean]) extends Result:
private val POINTS_FOR_WIN = 1.0d
private val POINTS_FOR_DRAW = 0.5d
private val POINTS_FOR_LOSS = 0.0d
Expand Down
6 changes: 3 additions & 3 deletions modules/rating/src/test/RatingCalculatorTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class RatingCalculatorTest extends lila.common.LilaTest:
val results = GameRatingPeriodResults(
List(
result match
case Glicko.Result.Win => GameResult(wRating, bRating, Some(true))
case Glicko.Result.Loss => GameResult(wRating, bRating, Some(false))
case Glicko.Result.Draw => GameResult(wRating, bRating, None)
case Glicko.Result.Win => DuelResult(wRating, bRating, Some(true))
case Glicko.Result.Loss => DuelResult(wRating, bRating, Some(false))
case Glicko.Result.Draw => DuelResult(wRating, bRating, None)
)
)
Glicko.calculator(ColorAdvantage.standard).updateRatings(ratings, results, true)
Expand Down
6 changes: 3 additions & 3 deletions modules/round/src/main/PerfsUpdater.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ final class PerfsUpdater(
val results = glicko2.GameRatingPeriodResults(
List(
game.winnerColor match
case Some(chess.White) => glicko2.GameResult(white, black, Some(true))
case Some(chess.Black) => glicko2.GameResult(black, white, Some(false))
case None => glicko2.GameResult(white, black, None)
case Some(chess.White) => glicko2.DuelResult(white, black, Some(true))
case Some(chess.Black) => glicko2.DuelResult(black, white, Some(false))
case None => glicko2.DuelResult(white, black, None)
)
)
// tuning TAU per game speed may improve accuracy
Expand Down

0 comments on commit d31bc4a

Please sign in to comment.