Class: Elimination

Elimination

Class representing an elimination tournament.


new Elimination(id [, options])

Create a new elimination 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

doubleElim :Boolean

If the format is double elimination.

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'

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:
  • []

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:

thirdPlaceMatch :Boolean

If there is a third place consolation match.

Type:
  • Boolean
Default Value:
  • false

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.