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

Shizen and Arashi environments

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

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

Exports

NameKindWhat it is
applyEarthquakefunctionCommit one bounded environmental resolution; matching, gravity and score remain the host game's job.
applyLightningfunctionCommit one lightning strike.
applyMagneticPulsefunctionApply one attraction pulse.
applyPowerDropfunctionCommit a previewed landing as one immutable operation.
AttractionPairPreviewtypeA pure attraction decision including the paired ids, axis, gap, midpoint and moves.
createNatureStatefunctionCreate a validated seeded native environment grid with fixed masks and mechanic switches.
EarthquakeKindtypeThe native fault, jumble or combined earthquake mode.
EarthquakeOptionstypeThe earthquake mode and optional enabled flag.
EnvironmentEventtypeA committed earthquake or lightning event with its native preview fields.
EnvironmentPreviewtypeA native earthquake or lightning preview before it is committed.
EnvironmentScheduletypeA periodic, one-turn or authored list of environment trigger turns.
EnvironmentTransitiontypeThe committed environment state, event list and pure preview.
FaultPreviewtypeA pure earthquake fault path, removed ids and resulting occupants/passability mask.
HorizontalDirectiontypeThe native left or right direction used for rebound decisions.
isEnvironmentTurnScheduledfunctionPure one-based schedule lookup: frequent is every second turn; rare is every eighth turn.
JumblePreviewtypeA pure eligible-patch shuffle and resulting occupants; reason explains when no patch exists.
LightningOptionstypeLightning enablement and explicit columns or a bounded column count.
LightningPreviewtypeA pure selected-column removal and resulting occupants/random state.
MagneticPreviewtypeA pure magnetic-pulse result; no input state or random source is consumed.
MarkingOptionstypeThe probability and optional count/anchor bounds used to mark magnetic stones.
markMagneticStonesfunctionDeterministically assign magnetic markings to settled stones without changing their IDs or colours.
NatureEntitytypeStable board occupant.
NatureErrorCodetypeStable native validation codes for grid, cell, marking and power-drop failures.
NatureEventtypeAn emitted native magnetic marking, attraction or power-drop event.
NatureMovetypeOne native stable-id move between two board coordinates.
NatureOptionstypeThe native grid dimensions, passability mask, occupants, seed and magnetic/rebound settings.
NatureOptionsErrorclassA typed native grid, cell, marking or power-drop validation error.
NaturePieceCelltypeA falling native stone with its cell coordinates and stable id.
NatureRulestypeThe fixed native magnetic and rebound rule switches.
NatureStatetypeThe immutable native environment state with stable ids, seeded random state and placement count.
NatureTransitiontypeThe native environment result, emitted events and optional pure preview.
PowerDropPreviewtypeThe pure normal landing, rebound attempts and final lock cells with resulting random state.
PowerDropRequesttypeThe native piece cells, pivot id and host-selected power/rebound options.
previewEarthquakefunctionPreview an earthquake, with Combined always fracturing before its one jumble attempt.
previewFaultfunctionPreview a bounded top-to-bottom fracture.
previewJumblefunctionPreview one seeded, nontrivial stone permutation inside a fully active connected rectangle no larger than 3×3.
previewLightningfunctionPreview seeded or explicitly selected columns; a mask gap or obstacle blocks the strike below it.
previewMagneticPulsefunctionPreview one bounded deterministic attraction pulse without mutating the state.
previewPowerDropfunctionPreview a single normal landing and, for a power drop, at most one validated one-cell rebound.
QuarterTurntypeA counterclockwise, unchanged or clockwise quarter-turn chosen by the host.
ReboundAttemptPreviewtypeOne tested rebound direction and quarter-turn with its collision-validity result.
ReboundDirectionModetypeWhether rebound prefers recent input/alternation or the seeded random source.

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