Pairing algorithms.
Methods
-
<static> bracket(power)
-
Determines seeding for elimination brackets.
Parameters:
Name Type Description power
Number Power of 2 for determining number of matches in first round.
Returns:
- Type
- Array.<Number>
-
<static> doubleElim(players)
-
Double elimination bracket generation.
Parameters:
Name Type Description players
Array.<Player> The players for the tournament.
Returns:
- Type
- Array.<Pairings>
-
<static> dutch(players, round, maxPoints)
-
Dutch pairing algorithm.
Parameters:
Name Type Description players
Array.<Player> The active players to pair.
round
Number The round number.
maxPoints
Number The maximum number of match points a player could have.
Returns:
- Type
- Pairings
-
<static> elim(players, thirdPlace)
-
Single elimination bracket generation.
Parameters:
Name Type Description players
Array.<Player> The players for the tournament.
thirdPlace
Boolean If there is a third place consolation match.
Returns:
- Type
- Array.<Pairings>
-
<static> loserFill(num, count)
-
Determines the order in which to fill the loser's bracket for double elimination.
Parameters:
Name Type Description num
Number The amount of matches.
count
Number How many times (starting at 0) the bracket has been filled.
Returns:
- Type
- Array.<Number>
-
<static> pairCompare(p1, p2)
-
Compares two players to determine which player plays white and which plays black.
Parameters:
Name Type Description p1
Player One of the players.
p2
Player The other player.
Returns:
- Type
- null | Array.<Player>
-
<static> robin(players, groups, double)
-
Round-robin algorithm (Berger tables).
Parameters:
Name Type Description players
Array.<Player> | Array.<Array.Player> An array of players, or an array of arrays of players.
groups
Boolean If players represents an array of arrays of players or not.
double
Boolean If players play each other once or twice.
Returns:
- Type
- Array.<Pairings>
-
<static> swiss(players, round, maxPoints, sort)
-
Swiss pairing algorithm.
Parameters:
Name Type Description players
Array.<Player> The active players to pair.
round
Number The round number.
maxPoints
Number The maximum number of match points a player could have.
sort
Boolean If the players are to be sorted by seed.
Returns:
- Type
- Pairings