Remove parameters we do not support

This commit is contained in:
Claude Brisson
2024-01-27 14:04:57 +01:00
parent 6d6fcda694
commit ff7cf47af5
3 changed files with 19 additions and 19 deletions

View File

@@ -50,6 +50,20 @@ object OpenGotha {
val placmtParams = ogTournament.tournamentParameterSet.placementParameterSet
val pairParams = ogTournament.tournamentParameterSet.pairingParameterSet
// some checks
if (genParams.genNBW2ValueAbsent.toDouble() != 0.0) {
throw Error("Pairgoth only support 0 for 'NBW for Absent player'")
}
if (genParams.genNBW2ValueBye.toDouble() != 2.0) {
throw Error("Pairgoth only support 1 for 'NBW for Bye player'")
}
if (genParams.genMMS2ValueBye.toDouble() != 2.0) {
throw Error("Pairgoth only support 1 for 'MMS for Bye player'")
}
val pairgothPairingParams = PairingParams(
base = BaseCritParams(
nx1 = pairParams.paiStandardNX1Factor.toDouble(),
@@ -71,10 +85,7 @@ object OpenGotha {
seedSystem2 = parseSeedSystem(pairParams.paiMaSeedSystem2 ?: "SPLITANDSLIP"),
additionalPlacementCritSystem1 = Criterion.valueOf(pairParams.paiMaAdditionalPlacementCritSystem1.uppercase()),
additionalPlacementCritSystem2 = Criterion.valueOf(pairParams.paiMaAdditionalPlacementCritSystem2.uppercase().replace("NULL", "NONE")),
nbwValueAbsent = genParams.genNBW2ValueAbsent.toDouble() / 2.0,
nbwValueBye = genParams.genNBW2ValueBye.toDouble() / 2.0,
mmsValueAbsent = genParams.genMMS2ValueAbsent.toDouble() / 2.0,
mmsValueBye = genParams.genMMS2ValueBye.toDouble() / 2.0,
mmsValueAbsent = genParams.genMMS2ValueAbsent.toDouble() / 2.0
),
secondary = SecondaryCritParams(
barThresholdActive = pairParams.paiSeBarThresholdActive.toBoolean(),
@@ -293,13 +304,7 @@ object OpenGotha {
).uppercase(Locale.ROOT)
}" genMMS2ValueAbsent="${
(tournament.pairing.pairingParams.main.mmsValueAbsent * 2).roundToInt()
}" genMMS2ValueBye="${
(tournament.pairing.pairingParams.main.mmsValueBye * 2).roundToInt()
}" genMMZero="30K" genNBW2ValueAbsent="${
(tournament.pairing.pairingParams.main.nbwValueAbsent * 2).roundToInt()
}" genNBW2ValueBye="${
(tournament.pairing.pairingParams.main.nbwValueBye * 2).roundToInt()
}" genRoundDownNBWMMS="true" komi="${tournament.komi}" location="${tournament.location}" name="${tournament.name}" nbMovesCanTime="${tournament.timeSystem.stones}" numberOfCategories="1" numberOfRounds="${tournament.rounds}" shortName="${tournament.shortName}" size="${tournament.gobanSize}" stdByoYomiTime="${tournament.timeSystem.byoyomi}"/>
}" genMMS2ValueBye="2" genMMZero="30K" genNBW2ValueAbsent="0" genNBW2ValueBye="2" genRoundDownNBWMMS="true" komi="${tournament.komi}" location="${tournament.location}" name="${tournament.name}" nbMovesCanTime="${tournament.timeSystem.stones}" numberOfCategories="1" numberOfRounds="${tournament.rounds}" shortName="${tournament.shortName}" size="${tournament.gobanSize}" stdByoYomiTime="${tournament.timeSystem.byoyomi}"/>
<HandicapParameterSet hdBasedOnMMS="${tournament.pairing.pairingParams.handicap.useMMS}" hdCeiling="${tournament.pairing.pairingParams.handicap.ceiling}" hdCorrection="${tournament.pairing.pairingParams.handicap.correction}" hdNoHdRankThreshold="${displayRank(tournament.pairing.pairingParams.handicap.rankThreshold)}"/>
<PlacementParameterSet>
<PlacementCriteria>

View File

@@ -50,10 +50,7 @@ data class MainCritParams(
val seedSystem2: SeedMethod = SeedMethod.SPLIT_AND_FOLD,
val additionalPlacementCritSystem1: Criterion = Criterion.RATING,
val additionalPlacementCritSystem2: Criterion = Criterion.NONE,
val nbwValueAbsent: Double = 0.0,
val nbwValueBye: Double = 1.0,
val mmsValueAbsent: Double = 0.5,
val mmsValueBye: Double = 1.0
) {
enum class DrawUpDown { TOP, MIDDLE, BOTTOM }
enum class SeedMethod { SPLIT_AND_FOLD, SPLIT_AND_RANDOM, SPLIT_AND_SLIP }
@@ -245,10 +242,7 @@ fun MainCritParams.Companion.fromJson(json: Json.Object, localDefault: MainCritP
seedSystem2 = json.getString("secondSeed")?.let { MainCritParams.SeedMethod.valueOf(it) } ?: localDefault?.seedSystem2 ?: default.seedSystem2,
additionalPlacementCritSystem1 = json.getString("firstSeedAddCrit")?.let { Criterion.valueOf(it) } ?: localDefault?.additionalPlacementCritSystem1 ?: default.additionalPlacementCritSystem1,
additionalPlacementCritSystem2 = json.getString("secondSeedAddCrit")?.let { Criterion.valueOf(it) } ?: localDefault?.additionalPlacementCritSystem2 ?: default.additionalPlacementCritSystem2,
nbwValueAbsent = json.getDouble("nbwValueAbsent") ?: localDefault?.nbwValueAbsent ?: default.nbwValueAbsent,
nbwValueBye = json.getDouble("nbwValueBye") ?: localDefault?.nbwValueBye ?: default.nbwValueBye,
mmsValueAbsent = json.getDouble("mmsValueAbsent") ?: localDefault?.mmsValueAbsent ?: default.mmsValueAbsent,
mmsValueBye = json.getDouble("mmsValueBye") ?: localDefault?.mmsValueBye ?: default.mmsValueBye
mmsValueAbsent = json.getDouble("mmsValueAbsent") ?: localDefault?.mmsValueAbsent ?: default.mmsValueAbsent
)
fun MainCritParams.toJson() = Json.Object(
@@ -263,7 +257,8 @@ fun MainCritParams.toJson() = Json.Object(
"firstSeed" to seedSystem1,
"secondSeed" to seedSystem2,
"firstSeedAddCrit" to additionalPlacementCritSystem1,
"secondSeedAddCrit" to additionalPlacementCritSystem2
"secondSeedAddCrit" to additionalPlacementCritSystem2,
"mmsValueAbsent" to mmsValueAbsent
)
fun SecondaryCritParams.Companion.fromJson(json: Json.Object, localDefault: SecondaryCritParams? = null) = SecondaryCritParams(