Reference
Gem Swap
import { … } from "@johnmorrisdotca/houseki/gem-swap";
21.0 kB minified and gzipped, with everything it imports (measured with esbuild)
Exports
| Name | Kind | What it is |
|---|---|---|
Action | type | A native player action accepted or rejected according to the current phase and rules. |
advanceTicks | function | Advances deterministic resolution ticks; wall-clock time is supplied separately by the host. |
advanceTime | function | Adds explicit host-measured elapsed time. |
applyAction | function | Applies one recorded player action. |
BlackHolePortal | type | A Gem Swap portal’s cell, remaining capacity, move lifetime and consumed stable ids. |
BoardPreset | type | A named native board geometry; custom dimensions remain a separate option. |
BoardShape | type | A native shaped active-cell layout applied to the row-major board. |
CAMPAIGN_CHECKSUM | constant | The stored Gem Swap campaign content fingerprint. |
CAMPAIGN_COUNT | constant | The number of stored Gem Swap campaign challenges. |
CancelToolAction | type | Clears the current Gem Swap tool preview. |
ChallengeRules | type | Gem Swap authored goals, optional move budget and seal layout. |
ConfirmToolAction | type | Commits the currently selected Gem Swap tool and target. |
createGame | function | Creates a deterministic stable board with at least one legal normal swap. |
CreateOptions | type | Creation settings for this native engine; dimensions, mode, seed and optional mechanics are validated together. |
decodeGame | function | Validates and reconstructs a state by replay; serialized board snapshots are never trusted. |
encodeGame | function | Encodes the initial rules plus accepted actions and logical inputs in canonical JSON. |
GameEvent | type | An event emitted by one native transition; type selects the event’s additional fields. |
GameMode | type | The native free, timed, daily or authored-challenge game mode. |
GameOutcome | type | The terminal outcome; null means the run has no terminal outcome yet. |
GamePhase | type | The native ready, resolution and ending phases. |
GameState | type | The immutable authoritative native game state, including its board, random state and recording. |
GameStatus | type | A compact native status derived from the authoritative state for a host’s labels. |
Gem | type | A gem has a stable identity and stored colour until it is cleared. |
GEM_SWAP_CAMPAIGN | constant | The frozen measured Gem Swap challenges with stable ids, setups, witnesses and review status. |
GEM_SWAP_LESSONS | constant | The frozen bilingual Gem Swap lessons with setup, teaching steps and witnesses. |
GemColour | type | A colour used by a normal gem. |
GemSwapCampaignLevel | type | One authored native challenge with its stable id, setup, winning witness, measurements and review status. |
GemSwapLesson | type | One bilingual native lesson with its authored setup, teaching steps and winning witness. |
GemSwapLessonStep | type | One bilingual native lesson instruction and the corresponding action or tick step. |
GemSwapOptionsError | class | Typed error for invalid settings or a board that cannot be generated safely. |
GemSwapReviewStatus | type | The existing campaign’s human-review-pending status; an engine witness is not human review. |
GENERATION_REVISION | constant | The stored Gem Swap campaign generation revision. |
Goal | type | The native authored goal; its discriminant selects the required collection or clearing condition. |
GRADING_VERSION | constant | The measurement/normalization revision used to grade Gem Swap challenges. |
GRADING_WEIGHTS | constant | The bounded Gem Swap metric weights used in the recorded grading formula. |
HintAction | type | Requests a native Gem Swap hint and marks assisted play. |
hintGame | function | Returns a deterministic legal swap hint and permanently marks the run assisted. |
legalActions | function | Lists all legal swaps that would be accepted from the current stable state. |
OrdinaryToolKind | type | A Gem Swap stored tool excluding the separately charged Black Hole. |
PlannedSpecial | type | The native Gem Swap cell and special kind planned for the end of a clear wave. |
ReplayError | class | A typed rejection of a malformed, unsupported or inconsistent native replay. |
ReplayOperation | type | One native Gem Swap action, fixed-tick advance or elapsed-time replay operation. |
ReshuffleAction | type | Requests a native Gem Swap recovery shuffle. |
reshuffleGame | function | Shuffles existing gem records in Relaxed play, preserving their colour and special counts. |
restartGame | function | Starts the exact initial ruleset and seed again, discarding all run progress. |
SAMPLE_BUDGET | constant | The fixed number of seeded playout samples used in the stored Gem Swap grading. |
Seal | type | A Gem Swap row-major seal cell and its remaining layers. |
SelectToolAction | type | Selects a stored Gem Swap tool without committing its target. |
Settings | type | Validated settings fixed at native game creation. |
SpecialKind | type | A Gem Swap beam, bomb or colour-burst special retained at its chosen anchor. |
statusOf | function | Derive the native phase, score, legal-move count, tools and goal/timer progress for host labels. |
SwapAction | type | Swaps two row-major cell addresses. |
TargetToolAction | type | Previews a selected Gem Swap tool on one row-major cell. |
ToolInventory | type | The native remaining counts of stored tools. |
ToolKind | type | A Gem Swap stored tool or advanced Black Hole selection. |
Transition | type | The resulting native state, emitted events and acceptance decision; rejected actions preserve the input. |
UndoAction | type | Requests restoration of the prior Gem Swap move. |
undoGame | function | Restores the last committed swap in Relaxed or Challenge play and marks assistance. |
validateChallengeWitness | function | Checks a complete authored witness through the public deterministic rules API. |