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

Gem Swap

import { … } from "@johnmorrisdotca/houseki/gem-swap";

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

Exports

NameKindWhat it is
ActiontypeA native player action accepted or rejected according to the current phase and rules.
advanceTicksfunctionAdvances deterministic resolution ticks; wall-clock time is supplied separately by the host.
advanceTimefunctionAdds explicit host-measured elapsed time.
applyActionfunctionApplies one recorded player action.
BlackHolePortaltypeA Gem Swap portal’s cell, remaining capacity, move lifetime and consumed stable ids.
BoardPresettypeA named native board geometry; custom dimensions remain a separate option.
BoardShapetypeA native shaped active-cell layout applied to the row-major board.
CAMPAIGN_CHECKSUMconstantThe stored Gem Swap campaign content fingerprint.
CAMPAIGN_COUNTconstantThe number of stored Gem Swap campaign challenges.
CancelToolActiontypeClears the current Gem Swap tool preview.
ChallengeRulestypeGem Swap authored goals, optional move budget and seal layout.
ConfirmToolActiontypeCommits the currently selected Gem Swap tool and target.
createGamefunctionCreates a deterministic stable board with at least one legal normal swap.
CreateOptionstypeCreation settings for this native engine; dimensions, mode, seed and optional mechanics are validated together.
decodeGamefunctionValidates and reconstructs a state by replay; serialized board snapshots are never trusted.
encodeGamefunctionEncodes the initial rules plus accepted actions and logical inputs in canonical JSON.
GameEventtypeAn event emitted by one native transition; type selects the event’s additional fields.
GameModetypeThe native free, timed, daily or authored-challenge game mode.
GameOutcometypeThe terminal outcome; null means the run has no terminal outcome yet.
GamePhasetypeThe native ready, resolution and ending phases.
GameStatetypeThe immutable authoritative native game state, including its board, random state and recording.
GameStatustypeA compact native status derived from the authoritative state for a host’s labels.
GemtypeA gem has a stable identity and stored colour until it is cleared.
GEM_SWAP_CAMPAIGNconstantThe frozen measured Gem Swap challenges with stable ids, setups, witnesses and review status.
GEM_SWAP_LESSONSconstantThe frozen bilingual Gem Swap lessons with setup, teaching steps and witnesses.
GemColourtypeA colour used by a normal gem.
GemSwapCampaignLeveltypeOne authored native challenge with its stable id, setup, winning witness, measurements and review status.
GemSwapLessontypeOne bilingual native lesson with its authored setup, teaching steps and winning witness.
GemSwapLessonSteptypeOne bilingual native lesson instruction and the corresponding action or tick step.
GemSwapOptionsErrorclassTyped error for invalid settings or a board that cannot be generated safely.
GemSwapReviewStatustypeThe existing campaign’s human-review-pending status; an engine witness is not human review.
GENERATION_REVISIONconstantThe stored Gem Swap campaign generation revision.
GoaltypeThe native authored goal; its discriminant selects the required collection or clearing condition.
GRADING_VERSIONconstantThe measurement/normalization revision used to grade Gem Swap challenges.
GRADING_WEIGHTSconstantThe bounded Gem Swap metric weights used in the recorded grading formula.
HintActiontypeRequests a native Gem Swap hint and marks assisted play.
hintGamefunctionReturns a deterministic legal swap hint and permanently marks the run assisted.
legalActionsfunctionLists all legal swaps that would be accepted from the current stable state.
OrdinaryToolKindtypeA Gem Swap stored tool excluding the separately charged Black Hole.
PlannedSpecialtypeThe native Gem Swap cell and special kind planned for the end of a clear wave.
ReplayErrorclassA typed rejection of a malformed, unsupported or inconsistent native replay.
ReplayOperationtypeOne native Gem Swap action, fixed-tick advance or elapsed-time replay operation.
ReshuffleActiontypeRequests a native Gem Swap recovery shuffle.
reshuffleGamefunctionShuffles existing gem records in Relaxed play, preserving their colour and special counts.
restartGamefunctionStarts the exact initial ruleset and seed again, discarding all run progress.
SAMPLE_BUDGETconstantThe fixed number of seeded playout samples used in the stored Gem Swap grading.
SealtypeA Gem Swap row-major seal cell and its remaining layers.
SelectToolActiontypeSelects a stored Gem Swap tool without committing its target.
SettingstypeValidated settings fixed at native game creation.
SpecialKindtypeA Gem Swap beam, bomb or colour-burst special retained at its chosen anchor.
statusOffunctionDerive the native phase, score, legal-move count, tools and goal/timer progress for host labels.
SwapActiontypeSwaps two row-major cell addresses.
TargetToolActiontypePreviews a selected Gem Swap tool on one row-major cell.
ToolInventorytypeThe native remaining counts of stored tools.
ToolKindtypeA Gem Swap stored tool or advanced Black Hole selection.
TransitiontypeThe resulting native state, emitted events and acceptance decision; rejected actions preserve the input.
UndoActiontypeRequests restoration of the prior Gem Swap move.
undoGamefunctionRestores the last committed swap in Relaxed or Challenge play and marks assistance.
validateChallengeWitnessfunctionChecks a complete authored witness through the public deterministic rules API.

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