本文へ移動

Taisen Brackets対戦

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

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

目次

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

matchupsFromGames関数

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

Matchups from a flat list of games: the games of one pair in one stage become one tie (a replay, two legs or a series), the stage orders the rounds, and the third-place stage becomes the third-place match. The sides of a tie are the home and away of its first game; each game's score is turned to that order.

インポート

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

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

定義

function matchupsFromGames(games: readonly PlayedGame[], options: GamesOptions): Matchup[]

引数

名前型説明
gamesreadonly PlayedGame[]

The games, in any order.

optionsGamesOptions

The stages in order, and which are the third-place match, two-legged ties or series.

戻り値

Matchup[]

The matchups, ready for layoutBracket and drawBracket.

例

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

const games = [
  { stage: "Semi-final", home: "Aurora", away: "Harbour", homeScore: 2, awayScore: 1 },
  { stage: "Semi-final", home: "Cascade", away: "Delta", homeScore: 0, awayScore: 1 },
  { stage: "Final", home: "Aurora", away: "Delta", homeScore: 3, awayScore: 1 },
];
console.log(drawBracket(matchupsFromGames(games, { stages: ["Semi-final", "Final"] })).startsWith("<svg"));
true

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

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

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