GroupStage tourney that tiebreaks until all done
This module wraps GroupStage and TieBreaker in such a way that
TieBreaker is invoked with as many rounds as is necessary to resolve ties (typically zero or one time). It is an implementation of tourney.
If you want to pick an exact number of players from a
GroupStage to advance to a second stage in a
Tourney this module (or something like it) is required.
GroupStage does not provide much in way of resolving ties except from with the statistics it works out internally, but if the number of points and the sum of map scores (
.against) are all identical it needs help to break up for the next stage.
GroupStage, but set a
var GS = ;var trn = 6 groupSize: 3 limit: 4 ; // want top 4 to proceed// matches are equivalent to a normal GroupStage instancetrnmatches;id: Id s: 1 r: 1 m: 1 p: 3 6id: Id s: 1 r: 2 m: 1 p: 1 6id: Id s: 1 r: 3 m: 1 p: 1 3id: Id s: 2 r: 1 m: 1 p: 4 5id: Id s: 2 r: 2 m: 1 p: 2 5id: Id s: 2 r: 3 m: 1 p: 2 4// score it with tiestrnmatches;trn; // truetrn; // false (cannot determine top 4 when one group is tied)trn; // true (forced to create another stage)// new set of matches is the subset of matches needed to be played to break// in this case we have to break an entire group, so it's a replaytrnmatches;id: Id s: 2 r: 1 m: 1 p: 4 5id: Id s: 2 r: 2 m: 1 p: 2 5id: Id s: 2 r: 3 m: 1 p: 2 4trnmatches;trn; // true - tiebreaker round overtrn; // true - no further tiebreaking neededtrncomplete; // can lock it down when isDone()// Since we scored all matches by seeds (ultimately) - top 4 can be chosen unambiguouslytrn;1 2 3 4
This module is here pretty much only here for the last step. If you tried this
slice when just using
GroupStage you could get 3 players from group one and 1 player from group two in the absence of sufficient information to split them up between groups.
Tournament.from relies on the
results().slice to select the people to pass through so this infomation must be as accurate as possible.
Since this module is a Tourney, you can use it in other tourneys.
The canonical groupstage to duel tournament implementation, groupstage-tb-duel uses this module as the "first stage" (even though it can be more than one stage when tiebreaking kicks in), then pipes the winners to a duel
Tournament - for almost all use cases, this is likely what you want.
If you have less conventional ideas about tournament structure, you could plumb this module into other things. The modularity is there.
$ npm install groupstage-tb
MIT-Licensed. See LICENSE file for details.