Use parameter barThresholdActive

This commit is contained in:
Claude Brisson
2024-05-24 15:13:12 +02:00
parent 2ad683668c
commit 0796c75fbc
2 changed files with 10 additions and 8 deletions

View File

@@ -92,16 +92,16 @@ data class GeographicalParams(
// handicap params // handicap params
data class HandicapParams( data class HandicapParams(
// minimizeHandicap is a secondary criteria but moved here // minimizeHandicap is a secondary criteria but moved here
val weight: Double = 0.0, // Should be paiSeDefSecCrit for SwCat, 0 for others val weight: Double = 0.0, // "Should be paiSeDefSecCrit for SwCat, 0 for others" ; unused for now, swiss with cats not implemented
val useMMS: Boolean = true, // if useMMS is false, hd will be based on rank val useMMS: Boolean = true, // if useMMS is false, hd will be based on rank
// Maximum rank used to compute handicap is rankThreshold // Maximum rank used to compute handicap is rankThreshold
val rankThreshold: Int = 0, // 0 is 1d val rankThreshold: Int = 0, // No handicap if at least one player is above this rank (0 is 1d)
val correction: Int = 1, // Handicap will be decreased by hdCorrection val correction: Int = 1, // Handicap will be decreased by hdCorrection
val ceiling: Int = 9, // Possible values are between 0 and 9 val ceiling: Int = 9, // Possible values are between 0 and 9
) { ) {
companion object { companion object {
val swissDefault = HandicapParams( val swissDefault = HandicapParams(
weight = 0.0, // TODO 'default disables handicap' => seems wrong, not used weight = 0.0,
useMMS = false, useMMS = false,
rankThreshold = -30, // 30k rankThreshold = -30, // 30k
ceiling = 0) ceiling = 0)

View File

@@ -35,9 +35,9 @@ class MacMahonSolver(round: Int,
override fun SecondaryCritParams.apply(p1: Pairable, p2: Pairable): Double { override fun SecondaryCritParams.apply(p1: Pairable, p2: Pairable): Double {
// Do we apply Secondary Criteria. // Do we apply Secondary Criteria?
// No player is above thresholds -> apply secondary criteria // - no player is above thresholds -> apply secondary criteria
// At least one player is above thresholds -> do not apply // - at least one player is above thresholds -> do not apply
val nbw2Threshold = val nbw2Threshold =
if (nbWinsThresholdActive) totalRounds if (nbWinsThresholdActive) totalRounds
@@ -46,8 +46,10 @@ class MacMahonSolver(round: Int,
val skipSecondary = val skipSecondary =
(2 * p1.nbW >= nbw2Threshold) || (2 * p1.nbW >= nbw2Threshold) ||
(2 * p2.nbW >= nbw2Threshold) || (2 * p2.nbW >= nbw2Threshold) ||
(p1.rank + p1.nbW >= mmBar) || barThresholdActive && (
(p2.rank + p2.nbW >= mmBar) (p1.rank + p1.nbW >= mmBar) ||
(p2.rank + p2.nbW >= mmBar)
)
return if (skipSecondary) 0.0 return if (skipSecondary) 0.0
else pairing.geo.apply(p1, p2) else pairing.geo.apply(p1, p2)