From 704906dd90509f595e710c666f98a96725296d51 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Thu, 11 Apr 2024 16:23:44 +0200 Subject: [PATCH] Bugfix: at H-2, 1h should become 0. --- .../kotlin/org/jeudego/pairgoth/pairing/solver/BaseSolver.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 0c6bde4..c1a9da4 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 @@ -513,7 +513,8 @@ sealed class BaseSolver( open fun HandicapParams.clamp(input: Int): Int { var hd = input if (hd >= correction) hd -= correction - if (hd < 0) hd = max(hd + correction, 0) + else if (hd < 0) hd = max(hd + correction, 0) + else hd = 0 // Clamp handicap with ceiling hd = min(hd, ceiling) hd = max(hd, -ceiling)