本文へ移動

Taisen Brackets対戦

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

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

目次

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

Game型

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

One game of a tie: a match of a knockout, a game of a series, a leg of an aggregate, a replay.

インポート

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

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

定義

interface Game {
    score: readonly [
        number,
        number
    ];
    date?: string;
    extraTime?: boolean;
    pens?: readonly [
        number,
        number
    ];
    replay?: boolean;
    note?: string;
}

メンバー

名前型説明
scorereadonly [number, number]

The score, in the order of the tie's sides.

date (省略可)string | undefined
extraTime (省略可)boolean | undefined

The game went to extra time (a.e.t.).

pens (省略可)readonly [number, number] | undefined

The penalty shoot-out's score, in the order of the tie's sides.

replay (省略可)boolean | undefined

This game replays a drawn one (the World Cup of 1934 and 1938).

note (省略可)string | undefined

例

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

const first: Game = { score: [2, 1], date: "2026-06-01" };
const svg = drawBracket([{ sides: ["Aurora", "Harbour"], kind: "series", bestOf: 3, games: [first, { score: [0, 1] }, { score: [1, 0] }] }]);
console.log(svg.startsWith("<svg"));
true

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

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

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