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 · Stone Collapse

Transitiontype

The resulting native state, emitted events and acceptance decision; rejected actions preserve the input.

Import it

import type { Transition } from "@johnmorrisdotca/houseki/stone-collapse";

Definition

interface Transition {
    readonly state: GameState;
    readonly events: readonly GameEvent[];
    readonly accepted: boolean;
    readonly reason?: string;
}

Members

NameTypeDescription
stateGameState
eventsreadonly GameEvent[]
acceptedboolean
reason (optional)string | undefined

Examples

import { applyAction, createGame } from "@johnmorrisdotca/houseki/stone-collapse";
import type { Action, Transition } from "@johnmorrisdotca/houseki/stone-collapse";

const state=createGame({seed:"docs"});
const action: Action={kind:"hint"};
const value: Transition = applyAction(state,action);
console.log(value == null ? value : typeof value === "object" ? Object.keys(value).slice(0,6) : value);
[ 'state', 'events', 'accepted', 'reason' ]

What it prints (run when this page was built)

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