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

tenkaToJSONfunction

A game as JSON, two spaces deep, with the format's number first. tenkaFromJSON reads it back.

Import it

import { tenkaToJSON } from "@johnmorrisdotca/tenka";

Definition

function tenkaToJSON(game: TenkaGame): string

Parameters

NameTypeDescription
gameTenkaGame

The current native game state.

Returns

string

A game as JSON, two spaces deep, with the format's number first. tenkaFromJSON reads it back.

Examples

import { startTenka, tenkaToJSON } from "@johnmorrisdotca/tenka";

const game = startTenka(10,["Seat 1","Seat 2"],42)!;
console.log(tenkaToJSON(game));
{
  "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.