decodeGamefunction
Reads a save by playing it again from the start, so a save cannot claim what its moves do not do. Throws on anything else.
Import it
import { decodeGame } from "@johnmorrisdotca/houseki/tsumiki";
Definition
function decodeGame(text: string): GameState
Parameters
| Name | Type | Description |
|---|---|---|
text | string | A save from encodeGame. |
Returns
GameState
The state its moves arrive at. Throws for anything that is not such a save.
Examples
import { createGame, decodeGame, encodeGame } from "@johnmorrisdotca/houseki/tsumiki";
console.log(decodeGame(encodeGame(createGame({ seed: "demo" }))).moves);0What it prints (run when this page was built)