Elo
object Elo
Pure ELO ladder math — the rating step and expected-score curve any ranked/competitive feature wants. No clock, no I/O, no domain types: a rating is an Int, a bout is 1-v-opponent, and step returns the new rating. Deterministic and testable.
Extracted from Kursi's local ranked ladder (Backlog #24). Domain-coupled bits (e.g. a difficulty→opponent-rating table) stay with the caller; only the generic math lives here.
Properties
Functions
Link copied to clipboard
Link copied to clipboard
fun step(rating: Int, opponentRating: Int, won: Boolean, k: Double = DEFAULT_K, floor: Int = 0, ceiling: Int = 4000): Int
One ELO step. Returns the NEW rating after a bout vs opponentRating, where won is the actual result. The change is k * (actual - expected), rounded so a win moves at least +1 and a loss at least -1 — STRICTLY monotonic in the result regardless of rounding — then clamped to [floor, ceiling].