本文へ移動

Taisen Brackets対戦

対戦の一覧から、トーナメント表をSVGで描きます。

対戦(たいせん)は、二者が向かい合って勝負することです。 名前について(英語)

目次

リファレンス · 各対戦の位置を計算

Matchup型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

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 type { Matchup } from "@johnmorrisdotca/taisen-brackets/layout";

ほかのエクスポート元: @johnmorrisdotca/taisen-brackets

定義

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
    ];
}

メンバー

名前型説明
id (省略可)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 (省略可)SideId | null | undefined

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

round (省略可)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 (省略可)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 (省略可)number | undefined

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

feeds (省略可)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 (省略可)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 (省略可)number | undefined

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

games (省略可)readonly Game[] | undefined

The games, oldest first.

legs (省略可)readonly Game[] | undefined

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

score (省略可)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 (省略可)readonly [number, number] | undefined

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

extraTime (省略可)boolean | undefined

The game with no games list went to extra time.

walkover (省略可)boolean | undefined

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

third (省略可)boolean | undefined

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

stage (省略可)"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 (省略可)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 (省略可)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 (省略可)string | undefined
seeds (省略可)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.

例

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

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/taisen-brackets 0.20.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。