Fix half MMS point
This commit is contained in:
@@ -29,11 +29,17 @@ object StandingsHandler: PairgothApiHandler {
|
||||
return min(max(pairable.rank, tournament.pairing.mmFloor), tournament.pairing.mmBar) + MacMahonSolver.mmsZero
|
||||
}
|
||||
|
||||
val historyHelper = HistoryHelper(tournament.historyBefore(round)) {
|
||||
// CB avoid code redundancy with solvers
|
||||
val historyHelper = HistoryHelper(tournament.historyBefore(round + 1)) {
|
||||
if (tournament.pairing.type == PairingType.SWISS) wins
|
||||
else tournament.pairables.mapValues {
|
||||
it.value.let {
|
||||
pairable -> mmBase(pairable) + ( nbW(pairable) ?: 0.0) // TODO take tournament parameter into account
|
||||
pairable ->
|
||||
mmBase(pairable) +
|
||||
(nbW(pairable) ?: 0.0) + // TODO take tournament parameter into account
|
||||
(1..round).map { round ->
|
||||
if (playersPerRound.getOrNull(round - 1)?.contains(pairable.id) == true) 0 else 1
|
||||
}.sum() * tournament.pairing.pairingParams.main.mmsValueAbsent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ abstract class BasePairingHelper(
|
||||
val Pairable.sodos: Double get() = historyHelper.sodos[id] ?: 0.0
|
||||
val Pairable.cums: Double get() = historyHelper.cumScore[id] ?: 0.0
|
||||
fun Pairable.missedRounds(upToRound: Int): Int = (1..upToRound).map { round ->
|
||||
if (historyHelper.playersPerRound.getOrNull(round)?.contains(id) == true) 0 else 1
|
||||
if (historyHelper.playersPerRound.getOrNull(round - 1)?.contains(id) == true) 0 else 1
|
||||
}.sum()
|
||||
fun Pairable.eval(criterion: Criterion) = evalCriterion(this, criterion)
|
||||
open fun evalCriterion(pairable: Pairable, criterion: Criterion) = when (criterion) {
|
||||
|
@@ -61,11 +61,13 @@ open class HistoryHelper(protected val history: List<List<Game>>, scoresGetter:
|
||||
}
|
||||
|
||||
// Set of all implied players for each round
|
||||
val playersPerRound = history.map {
|
||||
it.fold(mutableSetOf<ID>()) { acc, next ->
|
||||
acc.add(next.white)
|
||||
acc.add(next.black)
|
||||
acc
|
||||
val playersPerRound: List<Set<ID>> by lazy {
|
||||
history.map {
|
||||
it.fold(mutableSetOf<ID>()) { acc, next ->
|
||||
acc.add(next.white)
|
||||
acc.add(next.black)
|
||||
acc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user