Skip to the content

Houseki宝石

Run five native gem and stone engines, play measured challenges and lessons, and save deterministic games.

Houseki (宝石) is Japanese for a gem or precious stone. About the name

Contents

Reference · Tsumiki

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

NameTypeDescription
textstring

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);
0

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/houseki 0.5.0.