Handicap based on MMS
This commit is contained in:
@@ -14,6 +14,8 @@ abstract class BasePairingHelper(
|
||||
val historyHelper = if (pairables.first().let { it is TeamTournament.Team && it.teamOfIndividuals }) TeamOfIndividualsHistoryHelper(history) { scores }
|
||||
else HistoryHelper(history) { scores }
|
||||
|
||||
// Extend pairables with members from all rounds
|
||||
|
||||
// The main criterion that will be used to define the groups should be defined by subclasses
|
||||
// SOS and variants will be computed based on this score
|
||||
val Pairable.main: Double get() = scores[id] ?: 0.0
|
||||
|
@@ -394,7 +394,6 @@ sealed class BaseSolver(
|
||||
|
||||
if(true){
|
||||
println("Names "+p1.nameSeed()+" "+p1.group+" "+p2.nameSeed()+" "+p2.group)
|
||||
println(p1.rating)
|
||||
println("Seed Sytem = " + currentSeedSystem.toString())
|
||||
println("groupsize = "+p1.placeInGroup.second.toString()+" "+p2.placeInGroup.second.toString()+" "+groupSize)
|
||||
println("place in group p1 = "+cla1.toString()+" p2 = "+cla2.toString())
|
||||
@@ -481,17 +480,18 @@ sealed class BaseSolver(
|
||||
}
|
||||
|
||||
// Handicap functions
|
||||
// Has to be overridden if handicap is not based on rank
|
||||
open fun HandicapParams.handicap(white: Pairable, black: Pairable): Int {
|
||||
var hd = 0
|
||||
var pseudoRankWhite: Int = white.rank
|
||||
var pseudoRankBlack: Int = black.rank
|
||||
fun HandicapParams.handicap(white: Pairable, black: Pairable): Int {
|
||||
var pseudoRankWhite: Int = pseudoRank(white)
|
||||
var pseudoRankBlack: Int = pseudoRank(black)
|
||||
|
||||
pseudoRankWhite = min(pseudoRankWhite, rankThreshold)
|
||||
pseudoRankBlack = min(pseudoRankBlack, rankThreshold)
|
||||
hd = pseudoRankWhite - pseudoRankBlack
|
||||
return clamp(pseudoRankWhite - pseudoRankBlack)
|
||||
}
|
||||
|
||||
return clamp(hd)
|
||||
// Has to be overridden if handicap is not based on rank
|
||||
open fun HandicapParams.pseudoRank(pairable: Pairable): Int {
|
||||
return pairable.rank
|
||||
}
|
||||
|
||||
open fun HandicapParams.clamp(input: Int): Int {
|
||||
|
@@ -24,6 +24,14 @@ class MacMahonSolver(round: Int,
|
||||
}
|
||||
}
|
||||
|
||||
override fun HandicapParams.pseudoRank(pairable: Pairable): Int {
|
||||
if (useMMS) {
|
||||
return (pairable.mms / 2 + Pairable.MIN_RANK).toInt()
|
||||
} else {
|
||||
return pairable.rank
|
||||
}
|
||||
}
|
||||
|
||||
val Pairable.mmBase: Double get() = min(max(rank, mmFloor), mmBar) + mmsZero
|
||||
val Pairable.mms: Double get() = scores[id] ?: 0.0
|
||||
|
||||
|
Reference in New Issue
Block a user