本文へ移動

Taisen Brackets対戦

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

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

目次

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

advanceWinners関数

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

Fills the sides of every tie from the ties that feed it: a decided tie's winner takes its place in the next tie (the loser, for a third-place match). Returns new matchups; the ones given are not changed. Ties are filled in the order of the rounds, so a result for a later round is read against the sides this has just filled in.

インポート

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

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

定義

function advanceWinners(matchups: readonly Matchup[]): Matchup[]

引数

名前型説明
matchupsreadonly Matchup[]

The matchups of a bracket made by singleElimination, with some results in.

戻り値

Matchup[]

The matchups again, the winners put in their next places.

例

import { advanceWinners, singleElimination } from "@johnmorrisdotca/taisen-brackets";

const { matchups } = singleElimination([{ id: "A", name: "Aurora" }, { id: "B", name: "Harbour" }, { id: "C", name: "Cascade" }, { id: "D", name: "Delta" }]);
const played = matchups.map((m, i) => (i === 0 ? { ...m, score: [2, 1] as [number, number] } : m));
console.log(advanceWinners(played).length);
3

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

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

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