Commented old code from opengotha import/export
This commit is contained in:
@@ -1,19 +1,6 @@
|
||||
package org.jeudego.pairgoth.ext
|
||||
|
||||
import org.jeudego.pairgoth.model.CanadianByoyomi
|
||||
import org.jeudego.pairgoth.model.FischerTime
|
||||
import org.jeudego.pairgoth.model.Game
|
||||
import org.jeudego.pairgoth.model.MacMahon
|
||||
import org.jeudego.pairgoth.model.Pairable
|
||||
import org.jeudego.pairgoth.model.Player
|
||||
import org.jeudego.pairgoth.model.StandardByoyomi
|
||||
import org.jeudego.pairgoth.model.StandardTournament
|
||||
import org.jeudego.pairgoth.model.SuddenDeath
|
||||
import org.jeudego.pairgoth.model.Swiss
|
||||
import org.jeudego.pairgoth.model.TimeSystem
|
||||
import org.jeudego.pairgoth.model.Tournament
|
||||
import org.jeudego.pairgoth.model.displayRank
|
||||
import org.jeudego.pairgoth.model.parseRank
|
||||
import org.jeudego.pairgoth.model.*
|
||||
import org.jeudego.pairgoth.store.Store
|
||||
import org.jeudego.pairgoth.util.XmlFormat
|
||||
import org.jeudego.pairgoth.util.booleanAttr
|
||||
@@ -120,20 +107,21 @@ object OpenGotha {
|
||||
else -> throw Error("missing byoyomi type")
|
||||
},
|
||||
pairing = when (handParams.hdCeiling) {
|
||||
0 -> Swiss(
|
||||
when (pairingParams.paiMaSeedSystem1) {
|
||||
"SPLITANDFOLD" -> Swiss.Method.SPLIT_AND_FOLD
|
||||
"SPLITANDRANDOM" -> Swiss.Method.SPLIT_AND_RANDOM
|
||||
"SPLITANDSLIP" -> Swiss.Method.SPLIT_AND_SLIP
|
||||
else -> throw Error("unknown swiss pairing method")
|
||||
},
|
||||
when (pairingParams.paiMaSeedSystem2) {
|
||||
"SPLITANDFOLD" -> Swiss.Method.SPLIT_AND_FOLD
|
||||
"SPLITANDRANDOM" -> Swiss.Method.SPLIT_AND_RANDOM
|
||||
"SPLITANDSLIP" -> Swiss.Method.SPLIT_AND_SLIP
|
||||
else -> throw Error("unknown swiss pairing method")
|
||||
}
|
||||
)
|
||||
/*
|
||||
when (pairingParams.paiMaSeedSystem1) {
|
||||
"SPLITANDFOLD" -> SeedMethod.SPLIT_AND_FOLD
|
||||
"SPLITANDRANDOM" -> SeedMethod.SPLIT_AND_RANDOM
|
||||
"SPLITANDSLIP" -> SeedMethod.SPLIT_AND_SLIP
|
||||
else -> throw Error("unknown swiss pairing method")
|
||||
},
|
||||
when (pairingParams.paiMaSeedSystem2) {
|
||||
"SPLITANDFOLD" -> SeedMethod.SPLIT_AND_FOLD
|
||||
"SPLITANDRANDOM" -> SeedMethod.SPLIT_AND_RANDOM
|
||||
"SPLITANDSLIP" -> SeedMethod.SPLIT_AND_SLIP
|
||||
else -> throw Error("unknown swiss pairing method")
|
||||
}
|
||||
*/
|
||||
0 -> Swiss() // TODO
|
||||
else -> MacMahon() // TODO
|
||||
},
|
||||
rounds = genParams.numberOfRounds
|
||||
|
@@ -119,6 +119,39 @@ sealed class Solver(
|
||||
return result
|
||||
}
|
||||
|
||||
open fun applyBaseCriteria(p1: Pairable, p2: Pairable): Long {
|
||||
var score = 0L
|
||||
|
||||
// Base Criterion 1 : Avoid Duplicating Game
|
||||
// Did p1 and p2 already play ?
|
||||
score += avoidDuplicatingGames(p1, p2)
|
||||
// Base Criterion 2 : Random
|
||||
score += applyRandom(p1, p2)
|
||||
// Base Criterion 3 : Balance W and B
|
||||
score += applyBalanceBW(p1, p2)
|
||||
|
||||
return score
|
||||
}
|
||||
|
||||
// Main criteria
|
||||
open fun applyMainCriteria(p1: Pairable, p2: Pairable): Long {
|
||||
var score = 0L;
|
||||
|
||||
// Main criterion 1 avoid mixing category is moved to Swiss with category
|
||||
// TODO
|
||||
|
||||
// Main criterion 2 minimize score difference
|
||||
score += minimizeScoreDifference(p1, p2)
|
||||
|
||||
// Main criterion 3 If different groups, make a directed Draw-up/Draw-down
|
||||
// TODO
|
||||
|
||||
// Main criterion 4 seeding
|
||||
score += applySeeding(p1, p2)
|
||||
|
||||
return score
|
||||
}
|
||||
|
||||
// Weight score computation details
|
||||
// Base criteria
|
||||
open fun avoidDuplicatingGames(p1: Pairable, p2: Pairable): Long {
|
||||
@@ -156,39 +189,6 @@ sealed class Solver(
|
||||
return 0
|
||||
}
|
||||
|
||||
open fun applyBaseCriteria(p1: Pairable, p2: Pairable): Long {
|
||||
var score = 0L
|
||||
|
||||
// Base Criterion 1 : Avoid Duplicating Game
|
||||
// Did p1 and p2 already play ?
|
||||
score += avoidDuplicatingGames(p1, p2)
|
||||
// Base Criterion 2 : Random
|
||||
score += applyRandom(p1, p2)
|
||||
// Base Criterion 3 : Balance W and B
|
||||
score += applyBalanceBW(p1, p2)
|
||||
|
||||
return score
|
||||
}
|
||||
|
||||
// Main criteria
|
||||
open fun applyMainCriteria(p1: Pairable, p2: Pairable): Long {
|
||||
var score = 0L;
|
||||
|
||||
// Main criterion 1 avoid mixing category is moved to Swiss with category
|
||||
// TODO
|
||||
|
||||
// Main criterion 2 minimize score difference
|
||||
score += minimizeScoreDifference(p1, p2)
|
||||
|
||||
// Main criterion 3 If different groups, make a directed Draw-up/Draw-down
|
||||
// TODO
|
||||
|
||||
// Main criterion 4 seeding
|
||||
score += applySeeding(p1, p2)
|
||||
|
||||
return score
|
||||
}
|
||||
|
||||
open fun minimizeScoreDifference(p1: Pairable, p2: Pairable): Long {
|
||||
var score = 0L
|
||||
val scoreRange: Int = numberGroups
|
||||
|
Reference in New Issue
Block a user