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

How-to

Save and replay a game

Store native recordings and handle replay rejection explicitly.

Round-trip an engine save

import { createGame,applyAction,encodeGame,decodeGame,restartGame } from "@johnmorrisdotca/houseki/falling-triplets";
const state=applyAction(createGame({seed:"save-docs"}),{kind:"left"}).state;
const restored=decodeGame(encodeGame(state));
console.log(restored.score,restored.elapsedTicks,restartGame(restored).settings.seed);
0 0 save-docs

The save contains native settings, recording and a checkpoint. Decoding replays bounded operations and checks the derived checkpoint; editing only the visible board does not make a valid save. Use the decoder from the same game entry that encoded it. Catch malformed JSON, unsupported rules and checkpoint disagreement at your storage boundary.

Preserve host preferences separately

Language, cloth and sound are host preferences, not engine actions. Save them separately from gameplay. Daily seeds/dates must be chosen explicitly by the host; troubleshooting covers UTC dates and fixed content. Restart reconstructs the initial native setup; undo restores a prior move where that engine provides it. Neither operation is a cross-game save converter.

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