Documentation
¶
Overview ¶
Package keizer implements Keizer-style pairing for chess tournaments.
Keizer pairing works by ranking players by their current Keizer score (computed by the Keizer scorer, or by rating if no rounds have been played), then pairing top-down: rank 1 vs rank 2, rank 3 vs rank 4, and so on. The lowest-ranked player gets a bye if there's an odd number of players.
Repeat avoidance: by default, players must wait at least 3 rounds before being paired against the same opponent again. When a conflict occurs, the partner is swapped with the nearest available lower-ranked player.
Color assignment uses a priority cascade: absolute preferences (imbalance or consecutive same color) take priority, followed by strong preferences, color history differences, rank tiebreak, and board alternation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// AllowRepeatPairings controls whether players can be paired against
// the same opponent again within the tournament.
// Default: true (Keizer tournaments often span many rounds).
AllowRepeatPairings *bool `json:"allowRepeatPairings,omitempty"`
// MinRoundsBetweenRepeats is the minimum number of rounds that must
// pass before two players can be paired again.
// Only applies when AllowRepeatPairings is true.
// Default: 3.
MinRoundsBetweenRepeats *int `json:"minRoundsBetweenRepeats,omitempty"`
// ScoringOptions configures the internal Keizer scorer used for ranking.
// When nil, the scorer uses its own defaults.
ScoringOptions *keizerscoring.Options `json:"scoringOptions,omitempty"`
}
Options holds configurable settings for Keizer pairing. All fields are pointers to distinguish "not set" (nil = use default) from "explicitly set."
func ParseOptions ¶
ParseOptions converts a map[string]any (from Firestore/JSON) into typed Options. Unrecognized keys are ignored.
func (Options) WithDefaults ¶
WithDefaults returns a copy of Options with all nil fields filled in with system defaults.
type Pairer ¶
type Pairer struct {
// contains filtered or unexported fields
}
Pairer implements the chesspairing.Pairer interface for Keizer pairing.
func NewFromMap ¶
NewFromMap creates a new Keizer pairer from a map[string]any config.
func (*Pairer) Pair ¶
func (p *Pairer) Pair(ctx context.Context, state *chesspairing.TournamentState) (*chesspairing.PairingResult, error)
Pair generates pairings for the next round using the Keizer method.