Class: RoundRobin

RoundRobin

Class representing a round-robin pairing tournament.


new RoundRobin(id [, options])

Create a new round-robin pairing tournament.

Parameters:
Name Type Argument Default Description
id String

String to be the event ID.

options Object <optional>
{}

Options that can be defined for a tournament.

Extends

Members


active :Boolean

If the tournament is active.

Type:
  • Boolean
Inherited From:
Overrides:
Default Value:
  • false

bestOf :Number

Number of possible games for a match, where the winner must win the majority of games up to 1 + x/2 (used for byes).

Type:
  • Number
Default Value:
  • 1

currentRound :Number

Current round number.
0 if the tournament has not started, -1 if the tournament is finished.

Type:
  • Number
Default Value:
  • 0

cutEachGroup :Boolean

Whether to institute the cut limit for each group.

Type:
  • Boolean
Default Value:
  • false

cutLimit :Number

Breakpoint for determining how many players advance to the second stage of the tournament.
If 0, it will override the playoff format to null.
If -1, all players will advance.

Type:
  • Number
Default Value:
  • 0

cutType :'rank'|'points'

Method to determine which players advance to the second stage of the tournament.

Type:
  • 'rank' | 'points'
Default Value:
  • 'rank'

doubleRR :Boolean

If the format is double round-robin.

Type:
  • Boolean
Default Value:
  • false

drawValue :Number

The value of a draw/tie.
Must be 0 or greater.

Type:
  • Number
Inherited From:
Overrides:
Default Value:
  • 0.5

eventID :String

Alphanumeric string ID.

Type:
  • String
Inherited From:
Overrides:

format :'elim'|'robin'|'swiss'

Format for the first stage of the tournament.

Type:
  • 'elim' | 'robin' | 'swiss'
Inherited From:
Overrides:
Default Value:
  • 'elim'

<nullable> groupNumber :Number

Either the maximum size of each group, or the number of groups (minimum 2).
If null, there are no groups.

Type:
  • Number
Default Value:
  • null

groups :Array.<Array>

Array of groups of players.

Type:
  • Array.<Array>
Default Value:
  • []

lossValue :Number

The value of a loss.
Must be an integer.

Type:
  • Number
Inherited From:
Overrides:
Default Value:
  • 0

<nullable> maxPlayers :Number

Maximum number of players allowed to register for the tournament (minimum 4).
If null, there is no maximum.

Type:
  • Number
Inherited From:
Overrides:
Default Value:
  • null

<nullable> name :String

Name of the tournament.

Type:
  • String
Inherited From:
Overrides:
Default Value:
  • null

players :Array.<Player>

Array of all players in the tournament.

Type:
Inherited From:
Overrides:
Default Value:
  • []

<nullable> playoffs :'elim'|'2xelim'

Format for the second stage of the tournament.
If null, there is only one stage.

Type:
  • 'elim' | '2xelim'
Default Value:
  • null

rounds :Array.<Pairings>

Array of all pairings in the tournament.

Type:
Inherited From:
Overrides:
Default Value:
  • []

seededPlayers :Boolean

Whether or not to organize players by seed when pairing.

Type:
  • Boolean
Inherited From:
Overrides:
Default Value:
  • false

seedOrder :'asc'|'des'

If the seeding should be sorted in ascending or descending order.

Type:
  • 'asc' | 'des'
Inherited From:
Overrides:
Default Value:
  • 'asc'

startTime :Date

Creation date and time of the tournament.

Type:
  • Date
Inherited From:
Overrides:

tiebreakers :Array.<String>

Array of tiebreakers to use, in order of precedence.
Options include: buchholz-cut1, solkoff, median-buchholz, sonneborn-berger, baumbach, cumulative, versus, magic-tcg, pokemon-tcg.
Defaults for round-robin are sonneborn-berger and versus.

Type:
  • Array.<String>
Default Value:
  • null

winValue :Number

The value of a win.
Must be a positive integer.

Type:
  • Number
Inherited From:
Overrides:
Default Value:
  • 1

Methods


activeMatches(round)

Get the active matches in the tournament.
If no round is specified, it returns all active matches for all rounds.

Parameters:
Name Type Argument Default Description
round Number <nullable>
null

Optional round selector.

Inherited From:
Overrides:
Returns:
Type
Array.<Match>

addPlayer(alias, id, seed)

Create a new player and add them to the tournament.

Parameters:
Name Type Default Description
alias String

The name of the new player.

id String null

The ID of the new player. If null, one will be randomly generated.

seed Number null

The seed value of the player. Mandatory if seededPlayers is true.

Inherited From:
Overrides:
Returns:

If the player was created and added.

Type
Boolean

removePlayer(player)

Remove a player from the tournament.
If the tournament hasn't started, they are removed entirely.
If the tournament has started, they are dropped and marked inactive.

Parameters:
Name Type Description
player Player

The player to be removed.

Inherited From:
Overrides:
Returns:

If the player was removed or dropped.

Type
Boolean

result(match, playerOneWins, playerTwoWins [, draws])

Storing results of a match.

Parameters:
Name Type Argument Default Description
match Match

The match being reported.

playerOneWins Number

Number of wins for player one.

playerTwoWins Number

Number of wins for player two.

draws Number <optional>
0

Number of draws.


standings( [active])

Get the current standings of the tournament.

Parameters:
Name Type Argument Default Description
active Boolean <optional>
true

Filtering only active players.

Inherited From:
Overrides:
Returns:
Type
Array.<Player>

startEvent()

Starts the tournament.