Fix bye player game

This commit is contained in:
Claude Brisson
2024-09-04 17:35:06 +02:00
parent dbdbdfe746
commit 3c32e717e2

View File

@@ -127,7 +127,7 @@ sealed class BaseSolver(
var 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 // add game for ByePlayer
if (chosenByePlayer != ByePlayer) result += Game(id = nextGameId, table = 0, white = ByePlayer.id, black = chosenByePlayer.id, result = Game.Result.fromSymbol('b')) if (chosenByePlayer != ByePlayer) result += Game(id = nextGameId, table = 0, white = chosenByePlayer.id, black = ByePlayer.id, result = Game.Result.fromSymbol('w'))
if (debug) { if (debug) {
var sumOfWeights = 0.0 var sumOfWeights = 0.0
@@ -186,6 +186,7 @@ sealed class BaseSolver(
} }
open fun BaseCritParams.applyColorBalance(p1: Pairable, p2: Pairable): Double { open fun BaseCritParams.applyColorBalance(p1: Pairable, p2: Pairable): Double {
if (p1.id == 0 || p2.id == 0) return 0.0
// This cost is never applied if potential Handicap != 0 // This cost is never applied if potential Handicap != 0
// It is fully applied if wbBalance(sP1) and wbBalance(sP2) are strictly of different signs // It is fully applied if wbBalance(sP1) and wbBalance(sP2) are strictly of different signs
// It is half applied if one of wbBalance is 0 and the other is >=2 // It is half applied if one of wbBalance is 0 and the other is >=2