Fix handicap calculation

This commit is contained in:
Claude Brisson
2024-07-31 11:04:20 +02:00
parent 809573e580
commit 8be10645a8

View File

@@ -487,7 +487,8 @@ sealed class BaseSolver(
var hd = input var hd = input
// TODO - validate that "correction" is >= 0 (or modify the UI and the following code to handle the <0 case) // TODO - validate that "correction" is >= 0 (or modify the UI and the following code to handle the <0 case)
if (hd >= correction) hd -= correction if (hd >= correction) hd -= correction
else if (hd < 0) hd = max(hd + correction, 0) // TODO - Following line seems buggy... Get rid of it! What as the purpose?!
// else if (hd < 0) hd = max(hd + correction, 0)
else hd = 0 else hd = 0
// Clamp handicap with ceiling // Clamp handicap with ceiling
hd = min(hd, ceiling) hd = min(hd, ceiling)