summaryrefslogtreecommitdiff
path: root/sw-common-model
diff options
context:
space:
mode:
Diffstat (limited to 'sw-common-model')
-rw-r--r--sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/score/Score.kt21
1 files changed, 11 insertions, 10 deletions
diff --git a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/score/Score.kt b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/score/Score.kt
index 34dc0d99..36d0857f 100644
--- a/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/score/Score.kt
+++ b/sw-common-model/src/commonMain/kotlin/org/luxons/sevenwonders/model/score/Score.kt
@@ -3,20 +3,21 @@ package org.luxons.sevenwonders.model.score
import kotlinx.serialization.Serializable
@Serializable
-class ScoreBoard(val scores: List<PlayerScore>) {
+data class ScoreBoard(val scores: List<PlayerScore>) {
@OptIn(ExperimentalStdlibApi::class)
- val ranks = buildList {
- var r = 1
- add(1)
- for (i in 1..scores.lastIndex) {
- if (scores[i] < scores[i - 1]) {
- add(++r)
- } else {
- add(r)
+ val ranks: List<Int>
+ get() = buildList {
+ var r = 1
+ add(1)
+ for (i in 1..scores.lastIndex) {
+ if (scores[i] < scores[i - 1]) {
+ add(++r)
+ } else {
+ add(r)
+ }
}
}
- }
}
@Serializable
bgstack15