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

Magnetic Blocks

import { … } from "@johnmorrisdotca/houseki/magnetic-blocks";

28.2 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 fixed 60 Hz time, resolving phases in all modes and falling/locking only in Arcade.
applyActionfunctionApplies one movement, rotation, floor-switch or placement action without mutation.
BlocktypeThe native active 2×2 block, orientation and fixed-tick descent/lock counters.
blockBondsfunctionList the native stable-id bonds connecting adjacent gems in the active block.
blockCellsfunctionReturns stable-gem addresses after rotating the square block around its centre.
BondtypeAn undirected stable-id connection between two gems in a magnetic block.
calmGravityfunctionSettles bonded connected components one cell per deterministic bottom/ID priority step.
campaignManifestconstantThe frozen native campaign manifest with its ordering, revisions, checksum and measured levels.
canPlacefunctionTest whether the whole native block fits passable empty board cells.
ColourtypeA standard gem colour used by a magnetic block.
createGamefunctionCreates an immutable seeded 2×2-block game with a fixed queue and explicit floor schedule.
createLessonfunctionCreates a fresh lesson game with its authored setup and queue.
createLevelfunctionCreates a fresh game with the authored rules, board, queue, and finite move budget.
CreateOptionstypeCreation settings for this native engine; dimensions, mode, seed and optional mechanics are validated together.
decodeGamefunctionReplays bounded canonical input and verifies every saved checkpoint field.
encodeGamefunctionEncodes canonical settings, accepted tick-stamped actions and a verified replay checkpoint.
FloortypeThe native calm or magnetic floor used when settling blocks.
FloorScheduletypeA fixed, periodic or authored schedule selecting the floor for committed block placements.
GameEventtypeAn event emitted by one native transition; type selects the event’s additional fields.
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 native gem with a stable run-local id and colour.
getLessonfunctionFinds one of the three bilingual rules lessons by stable ID.
getLevelfunctionFinds a Magnetic Blocks campaign level by stable ID or one-based display number.
getTutorialfunctionFind a magnetic-block lesson by stable id; returns undefined when no lesson has that id.
GoaltypeThe native authored goal; its discriminant selects the required collection or clearing condition.
GRAVITY_TICKSconstantFixed 60 Hz ticks in the magnetic-block gravity phase.
impactSupportIdsfunctionCollects the occupied one-cell support layer under both block columns at first contact.
landingYfunctionFind the last legal block row before downward collision.
legalActionsfunctionLists accepted controls for the current falling or resolution phase.
lessonManifestconstantThe frozen native bilingual lessons and their authored teaching steps.
levelManifestconstantThe frozen ordered native levels; array indices start at zero and display numbers start at one.
LocalizedTexttypeOne authored text in English and Japanese.
MagneticBlocksOptionsErrorclassA typed native magnetic-block setup validation error.
MagneticCampaignLeveltypeOne authored native challenge with its stable id, setup, winning witness, measurements and review status.
MagneticCampaignManifesttypeThe ordered native campaign, its generation/grading revisions, checksum and measured levels.
MagneticDifficultyMetricstypeThe bounded engine measurements used to grade this campaign; they do not claim human difficulty.
magneticGravityfunctionMagnetic floor removes all bonds and settles each column segment independently.
MagneticLessontypeOne bilingual native lesson with its authored setup, teaching steps and winning witness.
MARK_TICKSconstantThe fixed 60 Hz ticks showing the magnetic-block match mark phase.
matchGroupsfunctionComputes deterministic orthogonal colour components of at least four gems.
ModetypeThe native game mode; authored challenges have fixed setup and queue rules.
PhasetypeThe native falling, resolution, pause and ending phases.
RecordedActiontypeA native action recording with the logical position needed for deterministic replay.
REMOVE_TICKSconstantFixed 60 Hz ticks in the magnetic-block removal phase.
removeIdsfunctionRemove the selected native cell indices and discard bonds whose endpoint gems were removed.
restartGamefunctionRestarts the same seed, custom starting board, fixed queue, rules and floor options.
SettingstypeValidated settings fixed at native game creation.
settlefunctionSettle surviving gems with the chosen floor rule and retain valid stable-id bonds.
statusOffunctionReturns a compact immutable status including current and upcoming floor state.
TransitiontypeThe resulting native state, emitted events and acceptance decision; rejected actions preserve the input.
tutorialManifestconstantAlias kept alongside other Houseki campaign lesson APIs.

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