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 · Tsumiki

ActionResulttype

What an applied action came to: whether it was taken, the state after it, and what happened.

Import it

import type { ActionResult } from "@johnmorrisdotca/houseki/tsumiki";

Definition

interface ActionResult {
    readonly accepted: boolean;
    readonly state: GameState;
    readonly events: readonly GameEvent[];
}

Members

NameTypeDescription
acceptedboolean
stateGameState
eventsreadonly GameEvent[]

Examples

import { applyAction, createGame, legalActions } from "@johnmorrisdotca/houseki/tsumiki";
import type { ActionResult } from "@johnmorrisdotca/houseki/tsumiki";

const game = createGame({ seed: "demo" });
const value: ActionResult = applyAction(game, legalActions(game)[0]!);
console.log(value.accepted);
true

What it prints (run when this page was built)

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