Skip to the content

Tenka天下

Play seeded world conquest for two to six, with dice battles, cards, computer players and saved games.

Tenka means the world under heaven in Japanese. About the name

Contents

Reference · Rules, maps and records

TenkaExportedtype

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

Import it

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

Definition

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[];
    };
};

Members

NameTypeDescription
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 (optional)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.

Examples

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: [] }
}

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tenka 2.2.0.