Skip to the content

Taisen Brackets対戦

Knockout brackets as SVG, from a list of ties.

Taisen (対戦, たいせん) is Japanese for a matchup: two sides facing each other. About the name

Contents

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

NameTypeDescription
matchupsreadonly Matchup[]

The matchups of a bracket made by singleElimination, with some results in.

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);
3

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/taisen-brackets 0.20.0.