From 72f59a6bde9efb786f7bfca70a678aedd1e7fb8f Mon Sep 17 00:00:00 2001 From: Quentin Rendu Date: Tue, 24 Oct 2023 11:17:39 +0200 Subject: [PATCH] Correct bug on handicap.color --- .../org/jeudego/pairgoth/pairing/solver/BaseSolver.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 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 a55903c..557ddba 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 @@ -94,6 +94,7 @@ sealed class BaseSolver( File(WEIGHTS_FILE).appendText("secHandiCost="+dec.format(pairing.handicap.handicap(p, q))+"\n") File(WEIGHTS_FILE).appendText("secGeoCost="+dec.format(pairing.geo.apply(p, q))+"\n") File(WEIGHTS_FILE).appendText("totalCost="+dec.format(openGothaWeight(p,q))+"\n") + } } } @@ -109,7 +110,7 @@ sealed class BaseSolver( if (DEBUG_EXPORT_WEIGHT) { for (it in sorted) { - println(it[0].nameSeed() + " " + it[0].place.toString() + " vs " +it[1].nameSeed() + " " +it[1].place.toString()) + println(it[0].nameSeed() + " " + it[0].place.toString() + " " + it[0].colorBalance.toString() + " vs " +it[1].nameSeed() + " " +it[1].place.toString() + " " + it[1].colorBalance.toString()) } } @@ -435,9 +436,9 @@ sealed class BaseSolver( val hd = pairing.handicap.handicap(p1,p2) if(hd==0){ if (p1.colorBalance > p2.colorBalance) { - score = 1.0 + score = - 1.0 } else if (p1.colorBalance < p2.colorBalance) { - score = -1.0 + score = 1.0 } else { // choose color from a det random if (detRandom(1.0, p1, p2) === 0.0) { score = 1.0