From d7a9c25a3460aef7ca12cdaea8bd85a6afd03202 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Mon, 2 Oct 2023 04:07:45 +0200 Subject: [PATCH] Add comments --- .../src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt index cde7e70..95bcdd4 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt @@ -430,12 +430,15 @@ sealed class Solver( // placeInGroup (of same score) : Pair(place, groupSize) private val Pairable.placeInGroup: Pair get() = _placeInGroup[id]!! private val _placeInGroup by lazy { + // group by group number sortedPairables.groupBy { it.group + // get a list { id { placeInGroup, groupSize } } }.values.flatMap { group -> group.mapIndexed { index, pairable -> Pair(pairable.id, Pair(index, group.size)) } + // get a map id -> { placeInGroup, groupSize } }.toMap() }