From f854873cc00709e43d8e65254ee1c4c661854481 Mon Sep 17 00:00:00 2001 From: Quentin Rendu Date: Tue, 19 Dec 2023 15:12:32 +0100 Subject: [PATCH] Correct bug in group size impacting DUDD cost --- .../kotlin/org/jeudego/pairgoth/pairing/BasePairingHelper.kt | 2 +- .../kotlin/org/jeudego/pairgoth/pairing/solver/BaseSolver.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/BasePairingHelper.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/BasePairingHelper.kt index 44d493f..2146809 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/BasePairingHelper.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/BasePairingHelper.kt @@ -24,7 +24,7 @@ abstract class BasePairingHelper( } // pairables sorted for pairing purposes protected val pairingSortedPairables by lazy { - pairables.sortedWith(::pairingSort) + pairables.sortedWith(::pairingSort).toMutableList() } // pairables sorted for pairing purposes protected val nameSortedPairables by lazy { diff --git a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/solver/BaseSolver.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/solver/BaseSolver.kt index b0053d5..fb1a7c6 100644 --- a/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/solver/BaseSolver.kt +++ b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/solver/BaseSolver.kt @@ -79,6 +79,8 @@ sealed class BaseSolver( println("Bye player : " + chosenByePlayer.nameSeed()) byePlayers.add(chosenByePlayer) nameSortedPairables.remove(chosenByePlayer) + // Keep chosenByePlayer in pairingSortedPairables to be identical to opengotha + pairingSortedPairables.remove(ByePlayer) } for (i in nameSortedPairables.indices) { @@ -326,7 +328,7 @@ sealed class BaseSolver( } if(debug){ - println("Names "+upperSP.nameSeed()+" "+lowerSP.nameSeed()) + println("Names "+upperSP.nameSeed()+" "+upperSP.group+" "+lowerSP.nameSeed()+" "+lowerSP.group) println("DUDD scenario, GroupDiff = "+scenario.toString()+" "+(upperSP.group-lowerSP.group).toString()) println("DUDD Upper/Lower modes = "+pairing.main.drawUpDownUpperMode.toString()+" "+pairing.main.drawUpDownLowerMode.toString()) println("u/lSPgroupsize = "+uSPgroupSize.toString()+" "+lSPgroupSize.toString())