Documentation
¶
Overview ¶
Package standard implements standard chess scoring (1-½-0).
In standard scoring, each player receives a fixed number of points per result: 1 for a win, ½ for a draw, 0 for a loss. Byes, forfeits, and absences may have their own configurable point values.
This is the scoring system used by FIDE for Swiss and round-robin tournaments, and the system used internally by the Swiss pairer for scoregroup formation (even when the tournament's public standings use a different scoring system like Keizer).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// PointWin is the points awarded for a win.
// Default: 1.0.
PointWin *float64 `json:"pointWin,omitempty"`
// PointDraw is the points awarded for a draw.
// Default: 0.5.
PointDraw *float64 `json:"pointDraw,omitempty"`
// PointLoss is the points awarded for a loss.
// Default: 0.0.
PointLoss *float64 `json:"pointLoss,omitempty"`
// PointBye is the points awarded for a bye.
// Default: 1.0 (full point bye, FIDE default).
PointBye *float64 `json:"pointBye,omitempty"`
// PointForfeitWin is the points awarded for a forfeit win.
// Default: 1.0.
PointForfeitWin *float64 `json:"pointForfeitWin,omitempty"`
// PointForfeitLoss is the points awarded for a forfeit loss.
// Default: 0.0.
PointForfeitLoss *float64 `json:"pointForfeitLoss,omitempty"`
// PointAbsent is the points awarded when a player is absent
// (neither plays nor receives a bye).
// Default: 0.0.
PointAbsent *float64 `json:"pointAbsent,omitempty"`
// PointExcused is the points awarded for an excused absence
// (ByeExcused). House-rule territory: FIDE does not specify a
// value. National federations differ on whether an excused
// absence earns a half point.
// Default: 0.0.
PointExcused *float64 `json:"pointExcused,omitempty"`
// PointClubCommitment is the points awarded when a player is
// absent due to a club commitment (ByeClubCommitment). House-rule
// territory: FIDE does not specify a value.
// Default: 0.0.
PointClubCommitment *float64 `json:"pointClubCommitment,omitempty"`
}
Options holds configurable settings for standard (1-½-0) scoring. All fields are pointers to distinguish "not set" (nil = use default) from "explicitly set to zero."
func ParseOptions ¶
ParseOptions converts a map[string]any (from Firestore/JSON) into typed Options. Unrecognized keys are ignored. Type mismatches use defaults.
func (Options) WithDefaults ¶
WithDefaults returns a copy of Options with all nil fields filled in with standard FIDE defaults (1-½-0).
type Scorer ¶
type Scorer struct {
// contains filtered or unexported fields
}
Scorer implements the chesspairing.Scorer interface for standard scoring.
func NewFromMap ¶
NewFromMap creates a new standard scorer from a map[string]any config.
func (*Scorer) PointsForResult ¶
func (s *Scorer) PointsForResult(result chesspairing.GameResult, rctx chesspairing.ResultContext) float64
PointsForResult returns the points awarded for a specific game result in standard scoring. For standard scoring, points are fixed regardless of opponent. When ResultContext.ByeType is non-nil the result is treated as a bye of that type; otherwise Result drives the value, with forfeit detection via Result.IsForfeit().
func (*Scorer) Score ¶
func (s *Scorer) Score(_ context.Context, state *chesspairing.TournamentState) ([]chesspairing.PlayerScore, error)
Score calculates standard scores for all active players.
Unlike Keizer scoring, standard scoring is simple: each result adds a fixed number of points. No iterative convergence is needed because points don't depend on rankings.