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
| Name | Type | Description |
|---|---|---|
format | 2 | The shape's number: |
game | "tenka" | Always |
generator | string | The package and version that wrote it, such as |
seed | number | The seed every deal, shuffle and die is drawn from. |
players | string[] | The names round the table, in seat order. |
rounds | number | Rounds before the count: 10, 20 or 60. |
placing | "auto" | "hand" | Whether the starting armies were scattered ( |
map (optional) | TenkaMapKey | undefined | The map, when it is not the world ( |
moves | (string | number)[][] | Every move, in order, each as the short list |
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)