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
| Name | Type | Description |
|---|---|---|
text | string | 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);42What it prints (run when this page was built)