Reference · Where every tie sits
advanceWinnersfunction
Fills the sides of every tie from the ties that feed it: a decided tie's winner takes its place in the next tie (the loser, for a third-place match). Returns new matchups; the ones given are not changed. Ties are filled in the order of the rounds, so a result for a later round is read against the sides this has just filled in.
Import it
import { advanceWinners } from "@johnmorrisdotca/taisen-brackets/layout";
Also exported from: @johnmorrisdotca/taisen-brackets
Definition
function advanceWinners(matchups: readonly Matchup[]): Matchup[]
Parameters
| Name | Type | Description |
|---|---|---|
matchups | readonly Matchup[] | The matchups of a bracket made by |
Returns
Matchup[]
The matchups again, the winners put in their next places.
Examples
import { advanceWinners, singleElimination } from "@johnmorrisdotca/taisen-brackets";
const { matchups } = singleElimination([{ id: "A", name: "Aurora" }, { id: "B", name: "Harbour" }, { id: "C", name: "Cascade" }, { id: "D", name: "Delta" }]);
const played = matchups.map((m, i) => (i === 0 ? { ...m, score: [2, 1] as [number, number] } : m));
console.log(advanceWinners(played).length);3What it prints (run when this page was built)