TieBreaker deals within groups ties in tournaments that has group-like equivalents. Such tournaments include:
TieBreaker will break ties for any tournament that implements
rawPositions, a special method that converts results into a raw array of positions per "group".
Unlike every other tournament type, this tournament CAN NOT be created directly. It needs a finished tournament instance to be created from, and the number of players we want to pick from this tournament:
var gs = 8 groupSize: 4 ;// score groupstage so that we have some tiesgsmatches;gs; // true
In this case the group stage is tied in the following ways:
Then, we may create tiebreakers in one of two ways, the simplest creates an
FFA style match for each group where we need to break it up:
var tb = TieBreaker; // want the top 4tbmatches;id: s: 1 r: 1 m: 1 // group 1 tiebreakerp: 3 8id: s: 2 r: 1 m: 1 // group 2 tiebreakerp: 4 5 7tb;tb;var top4 = tb; // will contain results for 1,3,4,5
The more advanced creates mini groupstages for each group involving the tied players:
var tb = TieBreaker;tbmatches;id: s: 1 r: 1 m: 1 p: 3 8// group 2 tiebreaker subgroupid: s: 2 r: 1 m: 1 p: 5 7id: s: 2 r: 2 m: 1 p: 4 7id: s: 2 r: 3 m: 1 p: 4 5
tb.matches is a non-empty array, there were ties that meant isolating the top 4 was impossible. Depending on how many players we request to forward (in this case 4),
TieBreaker may need more or fewer matches played.
At the end of the
TieBreaker tournament, you can call results and get the newly positioned results array. However, unless you were creating the tournament in
strict mode, the ties may not have been broken fully.
tbmatches;tb; // trueTieBreaker; // true
In this case we would need to recreate the
TieBreaker from the previous instance. Until the conflict has been resolved, you will need to keep doing this:
// recreate tiebreaker from partially broken/unbroken tiebreaker instancevar tb2 = TieBreaker;tb2matches;id: s: 2 r: 1 m: 1 p: 5 7id: s: 2 r: 2 m: 1 p: 4 7id: s: 2 r: 3 m: 1 p: 4 5
Repeating this procedure will eventually lead to a tiebreaker result where
!TieBreaker.isNecessary(prevTb, 4). In this case you can pick out the top 4 by slicing the results, or simply using
.from on your next tournament.
tb2; // trueTieBreaker; // false - assume we unbroke group 2 in tb2var top4 = tb2; // results for top 4// send the top 4 players from the groupstage to a two-round duel tournamentvar duel = Duel;
Without going into detail, it is fairly easy to end up in a situation where you have many different multi-way ties. The following is a
GroupStage test case:
If we get the results from
GroupStage, it will say that
[1,2,5,6] are all 1st placers, and thus tie all these four
results[i].pos attributes at
If we wanted the top 4 to proceed to a different tournament we would end up picking three players from group 1 and one player from group 2.
While this seems terrible,
GroupStage have nonetheless computed the results to the best of its knowledge.
By specifying the number of players you want to extract,
TieBreaker can create matches needed to forward the top
n players (a multiple of the number of groups) to another tournament fairly.
Using the ties outlined above, if we: ### Require top 4 Then need to break:
That gives 3 out of the 4 to proceed, and the last is player 5 who won his group alone and is guaranteed through.
Then only need to break the 1st place cluster in group 1, because we know 5 is one of the top 2.
Only need to break the 2nd place cluster from group 2, because we know [1,2,6] are all in the top 6.
Results out from a
TieBreaker instance are identical to the results received from the tournament we are breaking. The only difference is that we modify the
pos attributes in two ways:
n(fairly) by simply filtering by
r.pos <= n, or by calling
gposattributes are modified
posattributes are at the end built up like
TieBreaker only allows a multiple of the number of groups/sections to be chosen, lest unfair inferences about positions between groups needs to be made. See issue #3.
While TieBreaker implements
from slightly differently than any other tournament, is still a perfectly valid tournament. All the methods available on the tournament base class exist on
TieBreaker. Read the tournament API
MIT-Licensed. See LICENSE file for details.