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 855039b..cfaa8e3 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 @@ -377,7 +377,9 @@ sealed class BaseSolver( SPLIT_AND_RANDOM -> { if ((2 * cla1 < groupSize && 2 * cla2 >= groupSize) || (2 * cla1 >= groupSize && 2 * cla2 < groupSize)) { val randRange = maxSeedingWeight * 0.2 - val rand = detRandom(randRange, p1, p2) + val rand: Double + if (p1.nameSeed() > p2.nameSeed()) {rand = detRandom(randRange, p2, p1)} + else {rand = detRandom(randRange, p1, p2)} maxSeedingWeight - rand } else { 0.0 diff --git a/api-webapp/src/test/kotlin/PairingTests.kt b/api-webapp/src/test/kotlin/PairingTests.kt index 11448c2..e8402ac 100644 --- a/api-webapp/src/test/kotlin/PairingTests.kt +++ b/api-webapp/src/test/kotlin/PairingTests.kt @@ -89,10 +89,13 @@ class PairingTests: TestBase() { } fun compare_games(games:Json.Array, opengotha:Json.Array): Boolean{ - if (games.size != opengotha.size) return false + if (games.size != opengotha.size) { + val tmp = Game.fromJson(games.getJson(games.size-1)!!.asObject()) + if ((tmp.white != 0) and (tmp.black != 0)) {return false} + } val gamesPair = mutableSetOf>() val openGothaPair = mutableSetOf>() - for (i in 0 until games.size) { + for (i in 0 until opengotha.size) { val tmp = Game.fromJson(games.getJson(i)!!.asObject()) gamesPair.add(Pair(tmp.white, tmp.black)) val tmpOG = Game.fromJson(opengotha.getJson(i)!!.asObject()) @@ -245,8 +248,8 @@ class PairingTests: TestBase() { var games: Json.Array var firstGameID: Int var playersList = mutableListOf() - - var forcedPairingList = mutableListOf(1) + + var forcedPairingList = mutableListOf() var forcedPairing = mutableListOf() var forcedGames: Json.Array var game: Json