Documentation ¶
Index ¶
- Constants
- func ConvertResult(result int) string
- func RandChar(size int) string
- func SelectResult(resultDesc string) int
- type Game
- func (g *Game) GetBlackPlayer() *Player
- func (g *Game) GetHandicap() int
- func (g *Game) GetResult() int
- func (g *Game) GetRoundNumber() int
- func (g *Game) GetTableNumber() int
- func (g *Game) GetWhitePlayer() *Player
- func (g *Game) SetBlackPlayer(player *Player)
- func (g *Game) SetHandicap(val int)
- func (g *Game) SetKnownColor(knownColor bool)
- func (g *Game) SetResult(result int)
- func (g *Game) SetRoundNumber(roundNumber int)
- func (g *Game) SetTableNumber(tableNumber int)
- func (g *Game) SetWhitePlayer(player *Player)
- type GameIterator
- type Gotha
- func (g *Gotha) FlushGameToXML() (io.Reader, error)
- func (g *Gotha) GetTournament() *Tournament
- func (g *Gotha) ImportFromBytes(bs []byte) error
- func (g *Gotha) ImportFromReader(io io.Reader) error
- func (g *Gotha) ImportFromXMLFile(filePath string) error
- func (g *Gotha) SelectSystem(systemStr string)
- func (g *Gotha) SetTournament(t *Tournament)
- type IOption
- type InputOutput
- type OptionFunc
- type Player
- func (p *Player) Category(gps *parameter_set.GeneralParameterSet) int
- func (p *Player) GetKeyString() string
- func (p *Player) GetParticipating() []bool
- func (p *Player) GetRank() int
- func (p *Player) HasSameKeyString(player *Player) bool
- func (p *Player) SetFirstName(firstName string)
- func (p *Player) SetKeyString(keyStr string)
- func (p *Player) SetName(name string)
- func (p *Player) SetParticipating(val []bool)
- func (p *Player) SetParticipatingStr(val string)
- func (p *Player) SetRank(rating int)
- type PlayerIterator
- type ScoredPlayer
- func (sp *ScoredPlayer) GetCUSWX2(rn int) int
- func (sp *ScoredPlayer) GetCritValue(criterion int, roundNumber int) int
- func (sp *ScoredPlayer) GetGame(rn int) *Game
- func (sp *ScoredPlayer) GetNBWX2(rn int) int
- func (sp *ScoredPlayer) GetParticipation(rn int) int
- func (sp *ScoredPlayer) GetRating() int
- func (sp *ScoredPlayer) GetSOSWX2(rn int) int
- func (sp *ScoredPlayer) SetCUSWX2(rn int, value int)
- func (sp *ScoredPlayer) SetEXRX2(rn int, value int)
- func (sp *ScoredPlayer) SetEXTX2(rn int, value int)
- func (sp *ScoredPlayer) SetGame(rn int, g *Game)
- func (sp *ScoredPlayer) SetNBWX2(rn int, value int)
- func (sp *ScoredPlayer) SetParticipation(rn int, participation int)
- func (sp *ScoredPlayer) SetSDSWX4(rn int, value int)
- func (sp *ScoredPlayer) SetSOSWM1X2(rn int, value int)
- func (sp *ScoredPlayer) SetSOSWM2X2(rn int, value int)
- func (sp *ScoredPlayer) SetSOSWX2(rn int, value int)
- func (sp *ScoredPlayer) SetSSSWX2(rn int, value int)
- type ScoredPlayerComparator
- type ScoredPlayers
- type Tournament
- func (t *Tournament) AddGame(g *Game) bool
- func (t *Tournament) AddPlayer(p *Player)
- func (t *Tournament) AddSelectedPlayer(p *Player)
- func (t *Tournament) BergerArrange() *GameIterator
- func (t *Tournament) ChooseAByePlayer(alPlayers []*Player, roundNumber int)
- func (t *Tournament) FillPairingInfo(roundNumber int)
- func (t *Tournament) GetByePlayer(roundNumber int) *Player
- func (t *Tournament) GetGamesFromRound(rn int) []*Game
- func (t *Tournament) GetPlayerByKeyString(strNaFi string) *Player
- func (t *Tournament) GetPlayers() []*Player
- func (t *Tournament) GetTournamentSet() *parameter_set.TournamentParameterSet
- func (t *Tournament) MakeAutomaticPairing(roundNumber int) ([]*Game, bool)
- func (t *Tournament) Pair(roundNumber int) *GameIterator
- func (t *Tournament) SetByePlayer(roundNumber int, keyString string)
- func (t *Tournament) SetGameResult(rn int, tableNumber int, result string)
- func (t *Tournament) SetSelectedPlayers(strNaFis []string)
- func (t *Tournament) SetTournamentSet(set *parameter_set.TournamentParameterSet)
- func (t *Tournament) SortGameByTableNumber() []*Game
- func (t *Tournament) SortGameByTableNumberFromRn(rn int) []*Game
Constants ¶
View Source
const ( RESULT_UNKNOWN = 0 RESULT_BYDEF = 2 << 8 // 100000000 RESULT_LOSE = 2 << 3 RESULT_WHITEWINS = 17 RESULT_WHITEWINS_BYDEF = RESULT_WHITEWINS + RESULT_BYDEF RESULT_BLACKWINS = 18 RESULT_BLACKWINS_BYDEF = RESULT_BLACKWINS + RESULT_BYDEF RESULT_EQUAL = 19 RESULT_EQUAL_BYDEF = RESULT_EQUAL + RESULT_BYDEF RESULT_BOTHLOSE = RESULT_LOSE + RESULT_LOSE RESULT_BOTHLOSE_BYDEF = RESULT_BOTHLOSE + RESULT_BYDEF RESULT_BOTHWIN = 35 RESULT_BOTHWIN_BYDEF = RESULT_BOTHWIN + RESULT_BYDEF )
View Source
const ( MAX_NUMBER_OF_ROUNDS = 20 MAX_NUMBER_OF_PLAYERS = 1200 MAX_NUMBER_OF_TABLES = MAX_NUMBER_OF_PLAYERS / 2 PAIRING_GROUP_MIN_SIZE = 100 PAIRING_GROUP_MAX_SIZE = 3 * PAIRING_GROUP_MIN_SIZE )
View Source
const ( UNKNOWN = 0 ABSENT = -3 // 缺席 NOT_ASSIGNED = -2 // 未匹配 BYE = -1 PAIRED = 1 )
Variables ¶
This section is empty.
Functions ¶
func ConvertResult ¶
func SelectResult ¶
Types ¶
type Game ¶
type Game struct { RoundNumber int // begin from 0 TableNumber int // begin from 0 KnownColor bool Handicap int // contains filtered or unexported fields }
func (*Game) GetBlackPlayer ¶
func (*Game) GetHandicap ¶
func (*Game) GetRoundNumber ¶
func (*Game) GetTableNumber ¶
func (*Game) GetWhitePlayer ¶
func (*Game) SetBlackPlayer ¶
func (*Game) SetHandicap ¶
func (*Game) SetKnownColor ¶
func (*Game) SetRoundNumber ¶
func (*Game) SetTableNumber ¶
func (*Game) SetWhitePlayer ¶
type GameIterator ¶
type GameIterator struct {
// contains filtered or unexported fields
}
func NewGameIterator ¶
func NewGameIterator(data []*Game) *GameIterator
func (*GameIterator) HasNext ¶
func (ti *GameIterator) HasNext() bool
func (*GameIterator) Walk ¶
func (ti *GameIterator) Walk(f func(g *Game) (isStop bool))
type Gotha ¶
type Gotha struct { IO *InputOutput // contains filtered or unexported fields }
func (*Gotha) GetTournament ¶
func (g *Gotha) GetTournament() *Tournament
func (*Gotha) ImportFromBytes ¶
func (*Gotha) ImportFromXMLFile ¶
func (*Gotha) SetTournament ¶
func (g *Gotha) SetTournament(t *Tournament)
type IOption ¶
type IOption interface {
// contains filtered or unexported methods
}
func WithByePlayers ¶
func WithByePlayers() IOption
func WithPlayers ¶
func WithPlayers() IOption
type InputOutput ¶
type InputOutput struct { Doc *etree.Document Root *etree.Element // contains filtered or unexported fields }
func NewInputOutput ¶
func NewInputOutput() *InputOutput
func (*InputOutput) FlushGameToXML ¶
func (i *InputOutput) FlushGameToXML(games []*Game) (io.Reader, error)
func (*InputOutput) ImportFromReader ¶
func (i *InputOutput) ImportFromReader(ri io.Reader, t *Tournament) error
func (*InputOutput) WithOption ¶
func (i *InputOutput) WithOption(options ...IOption)
type OptionFunc ¶
type OptionFunc func(input *InputOutput)
type Player ¶
type Player struct { Name string FirstName string Rating int Rank int ParticipatingStr string // contains filtered or unexported fields }
func (*Player) Category ¶
func (p *Player) Category(gps *parameter_set.GeneralParameterSet) int
func (*Player) GetKeyString ¶
func (*Player) GetParticipating ¶
func (*Player) HasSameKeyString ¶
*
- 2 players never have the same key string.
- hasSameKeyString is, thus a way to test if 2 references refer to the same player *
func (*Player) SetFirstName ¶
func (*Player) SetKeyString ¶
func (*Player) SetParticipating ¶
func (*Player) SetParticipatingStr ¶
type PlayerIterator ¶
type PlayerIterator struct {
// contains filtered or unexported fields
}
func NewPlayerIterator ¶
func NewPlayerIterator(source *[]*Player) *PlayerIterator
func (*PlayerIterator) HasNext ¶
func (p *PlayerIterator) HasNext() bool
func (*PlayerIterator) Next ¶
func (p *PlayerIterator) Next() *Player
func (*PlayerIterator) Remove ¶
func (p *PlayerIterator) Remove()
type ScoredPlayer ¶
type ScoredPlayer struct { *Player NumberOfGroups int // 分组数量 Very redundant GroupNumber int GroupSize int // redundant InnerPlacement int // placement in homogeneous group (category and mainScore) beteen 0 and size(group) - 1 NbDU int // 上调次数 NbDD int // 下调次数 // contains filtered or unexported fields }
func NewScoredPlayer ¶
func NewScoredPlayer(gps *parameter_set.GeneralParameterSet, player *Player) *ScoredPlayer
func (*ScoredPlayer) GetCUSWX2 ¶
func (sp *ScoredPlayer) GetCUSWX2(rn int) int
func (*ScoredPlayer) GetCritValue ¶
func (sp *ScoredPlayer) GetCritValue(criterion int, roundNumber int) int
获取标准数据
func (*ScoredPlayer) GetGame ¶
func (sp *ScoredPlayer) GetGame(rn int) *Game
func (*ScoredPlayer) GetNBWX2 ¶
func (sp *ScoredPlayer) GetNBWX2(rn int) int
func (*ScoredPlayer) GetParticipation ¶
func (sp *ScoredPlayer) GetParticipation(rn int) int
func (*ScoredPlayer) GetRating ¶
func (sp *ScoredPlayer) GetRating() int
func (*ScoredPlayer) GetSOSWX2 ¶
func (sp *ScoredPlayer) GetSOSWX2(rn int) int
func (*ScoredPlayer) SetCUSWX2 ¶
func (sp *ScoredPlayer) SetCUSWX2(rn int, value int)
func (*ScoredPlayer) SetEXRX2 ¶
func (sp *ScoredPlayer) SetEXRX2(rn int, value int)
func (*ScoredPlayer) SetEXTX2 ¶
func (sp *ScoredPlayer) SetEXTX2(rn int, value int)
func (*ScoredPlayer) SetGame ¶
func (sp *ScoredPlayer) SetGame(rn int, g *Game)
func (*ScoredPlayer) SetNBWX2 ¶
func (sp *ScoredPlayer) SetNBWX2(rn int, value int)
func (*ScoredPlayer) SetParticipation ¶
func (sp *ScoredPlayer) SetParticipation(rn int, participation int)
func (*ScoredPlayer) SetSDSWX4 ¶
func (sp *ScoredPlayer) SetSDSWX4(rn int, value int)
func (*ScoredPlayer) SetSOSWM1X2 ¶
func (sp *ScoredPlayer) SetSOSWM1X2(rn int, value int)
func (*ScoredPlayer) SetSOSWM2X2 ¶
func (sp *ScoredPlayer) SetSOSWM2X2(rn int, value int)
func (*ScoredPlayer) SetSOSWX2 ¶
func (sp *ScoredPlayer) SetSOSWX2(rn int, value int)
func (*ScoredPlayer) SetSSSWX2 ¶
func (sp *ScoredPlayer) SetSSSWX2(rn int, value int)
type ScoredPlayerComparator ¶
type ScoredPlayerComparator struct { ScoredPlayers // contains filtered or unexported fields }
func NewScoredPlayerComparator ¶
func NewScoredPlayerComparator(scoredPlayers ScoredPlayers, criterion []int, roundNumber int) *ScoredPlayerComparator
func (*ScoredPlayerComparator) BetterScore ¶
func (spc *ScoredPlayerComparator) BetterScore(sp1 *ScoredPlayer, sp2 *ScoredPlayer) int
func (*ScoredPlayerComparator) Len ¶
func (spc *ScoredPlayerComparator) Len() int
func (*ScoredPlayerComparator) Less ¶
func (spc *ScoredPlayerComparator) Less(i, j int) bool
func (ScoredPlayerComparator) Swap ¶
func (spc ScoredPlayerComparator) Swap(i, j int)
type ScoredPlayers ¶
type ScoredPlayers []*ScoredPlayer
type Tournament ¶
type Tournament struct {
// contains filtered or unexported fields
}
func NewTournament ¶
func NewTournament() *Tournament
func (*Tournament) AddGame ¶
func (t *Tournament) AddGame(g *Game) bool
func (*Tournament) AddPlayer ¶
func (t *Tournament) AddPlayer(p *Player)
func (*Tournament) AddSelectedPlayer ¶
func (t *Tournament) AddSelectedPlayer(p *Player)
func (*Tournament) BergerArrange ¶
func (t *Tournament) BergerArrange() *GameIterator
func (*Tournament) ChooseAByePlayer ¶
func (t *Tournament) ChooseAByePlayer(alPlayers []*Player, roundNumber int)
func (*Tournament) FillPairingInfo ¶
func (t *Tournament) FillPairingInfo(roundNumber int)
func (*Tournament) GetByePlayer ¶
func (t *Tournament) GetByePlayer(roundNumber int) *Player
func (*Tournament) GetGamesFromRound ¶
func (t *Tournament) GetGamesFromRound(rn int) []*Game
func (*Tournament) GetPlayerByKeyString ¶
func (t *Tournament) GetPlayerByKeyString(strNaFi string) *Player
func (*Tournament) GetPlayers ¶
func (t *Tournament) GetPlayers() []*Player
func (*Tournament) GetTournamentSet ¶
func (t *Tournament) GetTournamentSet() *parameter_set.TournamentParameterSet
func (*Tournament) MakeAutomaticPairing ¶
func (t *Tournament) MakeAutomaticPairing(roundNumber int) ([]*Game, bool)
func (*Tournament) Pair ¶
func (t *Tournament) Pair(roundNumber int) *GameIterator
func (*Tournament) SetByePlayer ¶
func (t *Tournament) SetByePlayer(roundNumber int, keyString string)
func (*Tournament) SetGameResult ¶
func (t *Tournament) SetGameResult(rn int, tableNumber int, result string)
func (*Tournament) SetSelectedPlayers ¶
func (t *Tournament) SetSelectedPlayers(strNaFis []string)
func (*Tournament) SetTournamentSet ¶
func (t *Tournament) SetTournamentSet(set *parameter_set.TournamentParameterSet)
func (*Tournament) SortGameByTableNumber ¶
func (t *Tournament) SortGameByTableNumber() []*Game
func (*Tournament) SortGameByTableNumberFromRn ¶
func (t *Tournament) SortGameByTableNumberFromRn(rn int) []*Game
Click to show internal directories.
Click to hide internal directories.