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

singleEliminationfunction

The matchups of a single-elimination bracket for any number of teams, seeded in the standard way: the top seeds meet the lowest first, and when the number is not a power of two the top seeds have byes. The teams are in seed order (or carry a seed). No tie has a result yet; fill the results in and call advanceWinners to carry them forward.

Import it

import { singleElimination } from "@johnmorrisdotca/taisen-brackets/layout";

Also exported from: @johnmorrisdotca/taisen-brackets

Definition

function singleElimination(teams: readonly Team[], options?: SingleEliminationOptions): { teams: Team[]; matchups: Matchup[]; }

Parameters

NameTypeDescription
teamsreadonly Team[]

The teams, best seed first.

options (optional)SingleEliminationOptions

A third-place match, and a prefix for the ties' ids.

Returns

{ teams: Team[]; matchups: Matchup[]; }

The teams and the matchups, none played yet, ready for drawBracket.

Examples

import { singleElimination, drawBracket } from "@johnmorrisdotca/taisen-brackets";

const field = singleElimination([{ id: "A", name: "Aurora" }, { id: "B", name: "Harbour" }, { id: "C", name: "Cascade" }, { id: "D", name: "Delta" }]);
console.log(field.matchups.length, drawBracket(field).startsWith("<svg"));
3 true

What it prints (run when this page was built)

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