From 707eae15b32935a9c0fafe79f8d146c450b94548 Mon Sep 17 00:00:00 2001 From: Quentin Rendu Date: Thu, 7 Dec 2023 15:12:04 +0100 Subject: [PATCH] Add a game between ByePlayer and the player chosen to bye (constructed as a win) --- .../kotlin/org/jeudego/pairgoth/pairing/solver/BaseSolver.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 ae237d0..2b48442 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 @@ -119,8 +119,9 @@ sealed class BaseSolver( if (chosenByePlayer != ByePlayer) sorted.add(listOf(chosenByePlayer, ByePlayer)) println(sorted.size)*/ - val result = sorted.flatMap { games(white = it[0], black = it[1]) } - + var result = sorted.flatMap { games(white = it[0], black = it[1]) } + // add game for ByePlayer + if (chosenByePlayer != ByePlayer) result += Game(id = Store.nextGameId, white = ByePlayer.id, black = chosenByePlayer.id, result = Game.Result.fromSymbol('b')) if (DEBUG_EXPORT_WEIGHT) { var sumOfWeights = 0.0