tournament-organizer
    Preparing search index...

    Class Tournament

    Class representing a tournament.

    See TournamentValues for detailed descriptions of properties.

    Index

    Constructors

    Methods

    • Assigns a bye to a player in a specified round.

      Throws an error if it is not actively Swiss pairings, no player has the ID specified, if the player is already inactive, or if the player already has a match in the round.

      Parameters

      • id: string

        The ID of the player

      • round: number

        The round number

      Returns void

    • Assigns a loss to a player in a specified round.

      Throws an error if it is not actively Swiss pairings, no player has the ID specified, or if the player is already inactive.

      If the player has a match in the specified round, it is removed, they are assigned a loss, and the opponent is assigned a bye.

      Parameters

      • id: string

        The ID of the player

      • round: number

        The round number

      Returns void

    • Clears the results of a match.

      Throws an error if no match has the ID specified or if the match is still active.

      In elimination and stepladder formats, it reverses the progression of players in the bracket.

      Parameters

      • id: string

        The ID of the match

      Returns Match[]

      Array of matches that were updated

    • Create a new player.

      Throws an error if ID is specified and already exists, if the specified maximum number of players has been reached, if the tournament is in stage one and not Swiss format, or if the tournament is in stage two or complete.

      Parameters

      • name: string

        Alias of the player

      • id: string = undefined

        ID of the player (randomly assigned if omitted)

      Returns Player

      The newly created player

    • Updates the result of a match.

      Throws an error if no match has the ID specified or any player scores more than half the best of value

      In elimination and stepladder formats, moves players to their appropriate next matches.

      Parameters

      • id: string

        ID of the match

      • player1Wins: number

        Number of wins for player one

      • player2Wins: number

        Number of wins for player two

      • draws: number = 0

        Number of draws

      Returns Match[]

      Array of matches that were updated

    • Returns
          | "single-elimination"
          | "double-elimination"
          | "stepladder"
          | "swiss"
          | "round-robin"
          | "double-round-robin"

      The current pairing format if stage one or two

    • Returns {
          bestOf: number;
          bye: number;
          draw: number;
          loss: number;
          tiebreaks: (
              | "median buchholz"
              | "solkoff"
              | "sonneborn berger"
              | "koya system"
              | "cumulative"
              | "earned match wins"
              | "earned match losses"
              | "earned game wins"
              | "earned game losses"
              | "game win differential"
              | "neighborhood record"
              | "versus"
              | "mutual versus"
              | "game win percentage"
              | "opponent game win percentage"
              | "opponent match win percentage"
              | "opponent opponent match win percentage"
          )[];
          win: number;
      }

      An object with details regarding scoring

      • bestOf: number

        Number of possible games. Used to determine number of wins in a bye.

      • bye: number

        Points awarded for receiving a bye.

      • draw: number

        Points awarded for drawing a match.

      • loss: number

        Points awarded for losing a match.

      • tiebreaks: (
            | "median buchholz"
            | "solkoff"
            | "sonneborn berger"
            | "koya system"
            | "cumulative"
            | "earned match wins"
            | "earned match losses"
            | "earned game wins"
            | "earned game losses"
            | "game win differential"
            | "neighborhood record"
            | "versus"
            | "mutual versus"
            | "game win percentage"
            | "opponent game win percentage"
            | "opponent match win percentage"
            | "opponent opponent match win percentage"
        )[]

        Array of tiebreakers being used.

      • win: number

        Points awarded for winning a match.

    • Returns "none" | "ascending" | "descending"

      Sorting method, if players are rated/seeded

    • Returns {
          consolation: boolean;
          format:
              | "single-elimination"
              | "double-elimination"
              | "stepladder"
              | "swiss"
              | "round-robin"
              | "double-round-robin";
          initialRound: number;
          maxPlayers: number;
          rounds: number;
      }

      An object with details regarding the tournament

      • consolation: boolean

        If there is a third place match for single elimination.

      • format:
            | "single-elimination"
            | "double-elimination"
            | "stepladder"
            | "swiss"
            | "round-robin"
            | "double-round-robin"

        Format for the first stage.

      • initialRound: number

        Number of the first round.

      • maxPlayers: number

        Maximum number of players who can be enrolled. There is no maximum if this is zero.

      • rounds: number

        Number of rounds in the first stage.

    • Returns {
          advance: { method: "points" | "rank" | "all"; value: number };
          consolation: boolean;
          format: "single-elimination" | "double-elimination" | "stepladder";
      }

      An object with details regarding playoffs

      • advance: { method: "points" | "rank" | "all"; value: number }

        Determines how players advance from stage one to stage two.

        • method: "points" | "rank" | "all"

          The type of value to use if players advance.

        • value: number

          The breakpoint value for advancing players (greater than or equal to if method: 'points' and less than or equal to if method: 'rank').

      • consolation: boolean

        If there is a third place match for single elimination.

      • format: "single-elimination" | "double-elimination" | "stepladder"

        Format for the second stage. If null, then there is no stage two.

    • Returns "setup" | "stage-one" | "stage-two" | "complete"

      Current state of the tournament

    • Progress to the next round in the tournament.

      Throws an error if there are active matches, if the current format is elimination or stepladder, or when attempting to create matches for stage two and there are an insufficient number of players.

      Returns void

    • Remove a player.

      Throws an error if no player has the ID specified or if the player is already inactive.

      In active elimination and stepladder formats, adjusts paths for any matches that interact with the match the player is in.

      In active round-robin formats, replaces the player in all future matches with a bye.

      Parameters

      • id: string

        ID of the player

      Returns void

    • Start the tournament.

      Throws an error if there are an insufficient number of players (4 if double elimination, otherwise 2).

      Returns void