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

import { … } from "@johnmorrisdotca/houseki/tsumiki";

10.0 kB minified and gzipped, with everything it imports (measured with esbuild)

Exports

NameKindWhat it is
ActiontypeOne move: a piece from the tray, placed with its top left on a cell.
ActionResulttypeWhat an applied action came to: whether it was taken, the state after it, and what happened.
advanceTicksfunctionAdvances nothing: a placement is whole the moment it is made.
applyActionfunctionPlays one move: a piece is laid, every full row and column clears together, and the tray fills when it is empty.
BlocktypeOne filled cell: its run-local identity, its colour, and whether it is a stone a challenge asks to be cleared.
BlockColourtypeA colour used by a placed block.
BOARD_SIDEconstantThe board's side: eight cells each way.
canPlacefunctionWhether a piece from the tray can go with its top left on this cell, for a host to draw a ghost.
ChallengeGoaltypeWhat a challenge asks for: a score, a number of lines, or every stone cleared.
ChallengeOptionstypeAn authored game: its identity, seed, goal and the stones it starts with.
createChallengefunctionMakes an authored game from its seed, goal and stones.
createGamefunctionMakes a free game or a Daily: a Daily's seed is its date, so one date is one game for everybody.
createLevelfunctionMakes a level's game; throws for a level that does not exist.
CreateOptionstypeThe options a free game or a Daily is made from.
createTutorialfunctionMakes a lesson's game; throws for a lesson that does not exist.
decodeGamefunctionReads a save by playing it again from the start, so a save cannot claim what its moves do not do.
encodeGamefunctionA game as text: what it was and the moves made, never the score or the board, which a replay works out.
GameEventtypeWhat a move made happen, for a host to draw or sound.
GameModetypeThe free, daily or authored game mode.
GamePhasetypeWhere a game stands: waiting for a placement, won, lost, or finished with a score.
GameSettingstypeHow a game was set up, the whole of what a replay needs but the moves.
GameStatetypeThe whole of a game, returned new by every move: nothing in it is changed in place.
GameStatustypeA game's figures as a host would show them.
getLevelfunctionLooks a level up by its id or its display number; null where there is none.
getTutorialfunctionLooks a lesson up by its id; null where there is none.
legalActionsfunctionEvery placement allowed now, a bot's or a test's whole view of what can be done.
levelManifestconstantThe frozen graded levels, in order; array indices start at zero and display numbers at one.
LocalizedTexttypeWords in both languages.
PiecetypeA shape in the tray: its name, its colour, and its cells as row and column from its own top left.
restartGamefunctionThe same game from its start, with the same settings.
statusOffunctionA game's figures: its phase, its score, its lines and how far along its goal it is.
TsumikiLeveltypeOne graded level: its seed, goal and stones, and a line of moves the engine has been shown to win with.
TsumikiTutorialtypeOne bilingual lesson, with the game it is played on and a line of moves that wins it.
TsumikiTutorialSteptypeOne step of a lesson.
tutorialManifestconstantThe frozen bilingual lessons.

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