本文へ移動

Taisen Brackets対戦

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

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

目次

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

singleElimination関数

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

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

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

定義

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

引数

名前型説明
teamsreadonly Team[]

The teams, best seed first.

options (省略可)SingleEliminationOptions

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

戻り値

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

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

例

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

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

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

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