decodeGamefunction
Validates and reconstructs a state by replay; serialized board snapshots are never trusted.
Import it
import { decodeGame } from "@johnmorrisdotca/houseki/gem-swap";
Definition
function decodeGame(serialized: string): GameState
Parameters
| Name | Type | Description |
|---|---|---|
serialized | string | A saved JSON recording from this entry’s encodeGame; malformed or inconsistent saves throw. |
Returns
GameState
Validates and reconstructs a state by replay; serialized board snapshots are never trusted.
Examples
import { createGame, decodeGame, encodeGame } from "@johnmorrisdotca/houseki/gem-swap";
const state=createGame({seed:"docs"});
console.log(decodeGame(encodeGame(state)).phase);readyWhat it prints (run when this page was built)