Reference · Rules, maps and records
decodeTenkafunction
A kept game read back, or null for nothing kept, or for text that is not a game these rules can play out again: a browser's storage is somebody's to edit, and a half-understood game is worse than none.
Import it
import { decodeTenka } from "@johnmorrisdotca/tenka";
Definition
function decodeTenka(text: string | null): TenkaGame | null
Parameters
| Name | Type | Description |
|---|---|---|
text | string | null | The encoded game text to validate and replay. |
Returns
TenkaGame | null
The reconstructed game, or null for absent, malformed, unsupported or illegal saved data.
Examples
import { decodeTenka, encodeTenka, startTenka } from "@johnmorrisdotca/tenka";
const game = startTenka(10,["Seat 1","Seat 2"],42)!;
console.log(decodeTenka(encodeTenka(game))?.seed);42What it prints (run when this page was built)