本文へ移動

Tenka天下

2〜6人で、シードから始まる世界征服ゲームを遊べます。さいころでの戦い、カード、コンピューターの相手、ゲームの保存に対応します。

「天下」は、天の下に広がる世界を表す言葉です。 名前について(英語)

目次

リファレンス · ルール・地図・棋譜

TenkaExported型

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

A whole JSON export of one game: what tenkaToJSON writes and tenkaFromJSON reads.

インポート

import type { TenkaExported } from "@johnmorrisdotca/tenka";

定義

type TenkaExported = {
    format: typeof TENKA_EXPORT_FORMAT;
    game: "tenka";
    generator: string;
    seed: number;
    players: string[];
    rounds: number;
    placing: "auto" | "hand";
    map?: TenkaMapKey;
    moves: (string | number)[][];
    state: {
        round: number;
        phase: TenkaPhase;
        toPlay: TenkaSeat;
        winners: TenkaSeat[];
    };
};

メンバー

名前型説明
format2

The shape's number: TENKA_EXPORT_FORMAT.

game"tenka"

Always "tenka", so a file of this shape is not mistaken for another game's.

generatorstring

The package and version that wrote it, such as "tenka 1.1.0". For people; never read back.

seednumber

The seed every deal, shuffle and die is drawn from.

playersstring[]

The names round the table, in seat order.

roundsnumber

Rounds before the count: 10, 20 or 60.

placing"auto" | "hand"

Whether the starting armies were scattered ("auto") or placed by hand ("hand").

map (省略可)TenkaMapKey | undefined

The map, when it is not the world ("europe"); left out for the world.

moves(string | number)[][]

Every move, in order, each as the short list writeTenkaMove makes: ["a", 0, 1, 3].

state{ round: number; phase: TenkaPhase; toPlay: TenkaSeat; winners: TenkaSeat[]; }

Where the game stood when it was written. For people and for listings; never read back, since the moves say it.

例

import { startTenka, tenkaExported } from "@johnmorrisdotca/tenka";
import type { TenkaExported } from "@johnmorrisdotca/tenka";

const game = startTenka(10,["Seat 1","Seat 2"],42)!;
const value: TenkaExported = tenkaExported(game);
console.log(value);
{
  format: 2,
  game: 'tenka',
  generator: 'tenka 2.2.0',
  seed: 42,
  players: [ 'Seat 1', 'Seat 2' ],
  rounds: 10,
  placing: 'auto',
  moves: [],
  state: { round: 1, phase: 'reinforce', toPlay: 1, winners: [] }
}

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

ソースを見るGitHub で編集@johnmorrisdotca/tenka 2.2.0 のソースから作成しました。

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