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

Matchuptype

One tie: two sides and who went through. Everything but sides is optional, so that a bracket can be drawn from what is known (the sides of a first round, a few results) and fill in as the games are played.

Import it

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

Also exported from: @johnmorrisdotca/taisen-brackets

Definition

interface Matchup {
    id?: string;
    sides: readonly [
        SideId | Team | null,
        SideId | Team | null
    ];
    winner?: SideId | null;
    round?: number;
    date?: string;
    no?: number;
    feeds?: readonly [
        Feed | null,
        Feed | null
    ];
    kind?: MatchupKind;
    bestOf?: number;
    games?: readonly Game[];
    legs?: readonly Game[];
    score?: readonly [
        number,
        number
    ];
    pens?: readonly [
        number,
        number
    ];
    extraTime?: boolean;
    walkover?: boolean;
    third?: boolean;
    stage?: "play-in" | "repechage" | "bronze";
    judo?: JudoResult;
    home?: 0 | 1;
    note?: string;
    seeds?: readonly [
        string | number | null,
        string | number | null
    ];
}

Members

NameTypeDescription
id (optional)string | undefined

Names the tie for feeds of another and for the table. Left out, m1, m2… by position.

sidesreadonly [Team | SideId | null, Team | SideId | null]

The two sides: a team's id, or a whole Team. null is a side that is not known yet (To be decided).

winner (optional)SideId | null | undefined

The side that went through, by id. Left out, it is worked out from the games when they settle it.

round (optional)number | undefined

The round, from 1 (the first of the tree) to the final. 0 is a round-robin game, kept out of the tree. Left out, a tie is one round after the latest tie that feeds it.

date (optional)string | undefined

A sortable date (2022-12-18, or with a time), which orders the ties of one round and tells which feeds which.

no (optional)number | undefined

A number that orders the ties of a round before the date does (a World Cup's match numbers).

feeds (optional)readonly [Feed | null, Feed | null] | undefined

Which ties feed this one: feeds[0] the one whose winner takes the first side, feeds[1] the second. Names the tree outright, for a bracket whose sides are not known yet. Left out, a winner goes on to the next tie its team plays.

kind (optional)MatchupKind | undefined

How the tie is contested. Left out: replay if a game replays, series if there is a bestOf or several games, else game.

bestOf (optional)number | undefined

The length of the series (7 for a best-of-seven).

games (optional)readonly Game[] | undefined

The games, oldest first.

legs (optional)readonly Game[] | undefined

The legs of an aggregate tie: the same as games, with kind "aggregate".

score (optional)readonly [number, number] | undefined

The result, without the games: the score of a game, the games won of a series ([4, 2]), the total of an aggregate.

pens (optional)readonly [number, number] | undefined

The shoot-out of a game with no games list.

extraTime (optional)boolean | undefined

The game with no games list went to extra time.

walkover (optional)boolean | undefined

The tie was settled without a game (a side withdrew): the note says so.

third (optional)boolean | undefined

This is the third-place match: it leads nowhere and is drawn apart.

stage (optional)"play-in" | "repechage" | "bronze" | undefined

"play-in": a game of a play-in (the NBA's) that is outside the rounds of the tree: its winner (and loser, see feeds) goes on to a place the tree's ties name. Drawn by the playin layout and, apart, under the other layouts' trees. "repechage" and "bronze": a judo repechage contest and a bronze medal contest, fed by the losers of the tree's ties (judoBracket writes them); drawn apart under the tree.

judo (optional)JudoResult | undefined

A judo contest's scores: ippon, waza-ari, yuko, shido, hansoku-make, golden score and time. The first side is white, the second blue. The score, the winner and the notes come from it; see judoOutcome.

home (optional)0 | 1 | undefined

The side playing at home (0 or 1), for the at wording of the columns layout: the home side is drawn second, after "AT". Left out, the second side.

note (optional)string | undefined
seeds (optional)readonly [string | number | null, string | number | null] | undefined

The seed tags of the two sides for this tie (["C1", "WC2"]), written beside the marks in the road look when seeds is on; a side's Team.tag is used where this has none.

Examples

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

const final: Matchup = { id: "final", sides: ["ARG", "FRA"], score: [3, 3], extraTime: true, pens: [4, 2], date: "2022-12-18" };
console.log(drawBracket([final]).startsWith("<svg"));
true

What it prints (run when this page was built)

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