@echecs/tournament - v3.3.0
    Preparing search index...

    Class Tournament

    Stateful chess tournament orchestrator. Drives any pairing system through a common lifecycle: create, pair, record results, standings, repeat.

    Follows the PositionData / Position pattern: TournamentData is the plain data interface, Tournament is the class that wraps it.

    import { Tournament } from '@echecs/tournament';
    import { dutch } from '@echecs/swiss';

    const t = new Tournament(
    {
    completedRounds: [],
    players: [
    { id: 'alice', points: 0, rank: 1 },
    { id: 'bob', points: 0, rank: 2 },
    { id: 'carol', points: 0, rank: 3 },
    { id: 'dave', points: 0, rank: 4 },
    ],
    totalRounds: 3,
    },
    { pairingSystem: dutch },
    );

    const r1 = t.pair();
    // record results...
    const standings = t.standings();
    Index

    Constructors

    Accessors

    • get isComplete(): boolean

      Whether all rounds have been completed.

      Returns boolean

    • get totalRounds(): number

      Total number of rounds in the tournament.

      Returns number

    Methods

    • Removes a result, reverting a game back to a pairing.

      Parameters

      • round: number

        The 1-based round number.

      • white: string

        Player identifier for white.

      • black: string

        Player identifier for black.

      Returns void

      If the round is invalid or no matching game exists.

    • Corrects a result in any round (including completed). Logs a comment. Handles adjourned games (FIDE C.04.2 Art 3.1).

      Parameters

      • round: number

        The 1-based round number.

      • game: Game

        The corrected game result.

      Returns void

      If the round is invalid or no matching pairing exists.

    • Late entry (FIDE C.04.2 Art 2.4). Player joins with their specified points for missed rounds, paired from next pair() call.

      Parameters

      Returns void

    • Generates pairings for the next round using the injected pairing system. If a current round exists and all games are complete, promotes it to completedRounds before pairing the next round.

      Returns Pairings

      The pairings and byes for the new round.

      If the tournament is complete or the current round has unrecorded results.

    • Records a result for a pairing in the current round. Validates the pairing exists. Results accumulate on currentRound. The round is promoted to completedRounds by the next pair() call.

      Parameters

      • game: Game

        The game result to record.

      Returns void

      If no round has been paired or the players don't match any pairing.

    • Returns players ranked by score descending, with optional tiebreaks applied in order. Scoring uses the tournament's ScoringSystem.

      Parameters

      • Optionaltiebreaks: Tiebreak[]

        Ordered array of tiebreak functions.

      Returns Standing[]

      Sorted standings array.

    • Player leaves. No longer paired (FIDE C.04.2 Art 3.2).

      Parameters

      • playerId: string

      Returns void