本文へ移動

Taisen Brackets対戦

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

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

目次

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

BracketLayout型

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

The shape of a bracket worked out from its ties: the ties, the halves, the rounds, the rows and the champion.

インポート

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

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

定義

interface BracketLayout {
    ties: Tie[];
    shape: "halves" | "ltr" | "forest";
    sides: LayoutSide[];
    final: {
        i: number;
        y: number;
        order: readonly [
            0 | 1,
            0 | 1
        ];
    } | null;
    finalIndex: number | null;
    columns: number[];
    rounds: number;
    rows: number;
    other: number[];
    robin: number[];
    playIn: number[];
    third: number | null;
    place: Place[];
    parent: number[];
    champion: Team | null;
    teams: Team[];
}

メンバー

名前型説明
tiesTie[]

Every tie, in the order given.

shape"halves" | "ltr" | "forest"

How the tree is drawn: two halves that meet at the final, one tree left to right, or several (no single final).

sidesLayoutSide[]
final{ i: number; y: number; order: readonly [0 | 1, 0 | 1]; } | null

The final, when the halves meet at it: its row and the order of its sides (the first is the left half's).

finalIndexnumber | null

The tie that is the final, when the last round holds one, in any shape.

columnsnumber[]

The rounds drawn on the sides, in order (the final's own round is left out when the halves meet at it).

roundsnumber

The number of rounds of the tree, the final's included.

rowsnumber
othernumber[]

Ties that lead nowhere near the final, and round-robin games.

robinnumber[]
playInnumber[]

The play-in games (Matchup.stage), kept out of the tree.

thirdnumber | null

The third-place match, when there is one.

placePlace[]

Where each tie is: a half, the final, or elsewhere; by tie index.

parentnumber[]

The tie each tie feeds, by index; -1 for none.

championTeam | null

The team that won the final, when it has been played.

teamsTeam[]

Every team that appears, by id.

例

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

const layout: BracketLayout = layoutBracket([{ sides: ["Aurora", "Harbour"], score: [2, 1] }, { sides: ["Cascade", "Delta"], score: [0, 1] }, { sides: ["Aurora", "Delta"], score: [3, 1] }]);
console.log(layout.shape, layout.rounds, drawBracket(layout).startsWith("<svg"));
halves 2 true

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

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

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