Skip to content

Commit

Permalink
fix formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
aarew12 committed Nov 11, 2024
1 parent beb17b5 commit 957507d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/src/main/scala/Elo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ object Elo extends RelaxedOpaqueInt[Elo]:
def computePerformanceRating(games: Seq[Game]): Option[Elo] =
games.nonEmpty.option:
val averageOpponentRating = games.map(_.opponentRating).sum / games.size
val percentageScore = BigDecimal(games.map(_.points.value).sum / games.size).setScale(2, BigDecimal.RoundingMode.HALF_UP)
val percentageScore =
BigDecimal(games.map(_.points.value).sum / games.size).setScale(2, BigDecimal.RoundingMode.HALF_UP)
averageOpponentRating + performanceRatingTableFIDE.getOrElse(percentageScore, 0)

final class Player(val rating: Elo, val kFactor: KFactor)
Expand Down Expand Up @@ -101,7 +102,6 @@ object Elo extends RelaxedOpaqueInt[Elo]:
// but it mirrors the reference table on
// https://handbook.fide.com/chapter/B022022 8.1.2


// 1.4.9 FIDE table
val performanceRatingTableFIDE: Map[BigDecimal, Int] = Map(
BigDecimal("0.00") -> -800,
Expand Down Expand Up @@ -206,5 +206,3 @@ object Elo extends RelaxedOpaqueInt[Elo]:
BigDecimal("0.99") -> 677,
BigDecimal("1.00") -> 800
)


0 comments on commit 957507d

Please sign in to comment.