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

tenkaFromJSONfunction

A game from JSON that tenkaToJSON wrote, or text that encodeTenka did. Nothing in it is trusted: the game is dealt again from the seed and every move is played through the rules, so what comes back is a game these rules made. Null when the text is not JSON, is of a later format than this version reads, is another game's, or holds a move that could not have been made when it was.

Import it

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

Definition

function tenkaFromJSON(text: string): TenkaGame | null

Parameters

NameTypeDescription
textstring

The encoded game text to validate and replay.

Returns

TenkaGame | null

The reconstructed game, or null for malformed, unsupported, foreign or illegal saved data.

Examples

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

const game = startTenka(10,["Seat 1","Seat 2"],42)!;
console.log(tenkaFromJSON(tenkaToJSON(game))?.seed);
42

What it prints (run when this page was built)

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