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 · Colour Chains

applyScheduledActionsfunction

Applies a scheduler batch until the pair locks or the run pauses; accepted actions are recorded by the engine.

Import it

import { applyScheduledActions } from "@johnmorrisdotca/houseki/colour-chains";

Definition

function applyScheduledActions(game: GameState, input: InputSchedulerState, actions: readonly Action[], applyAction: (state: GameState, action: Action) => Transition): readonly [GameState, InputSchedulerState, readonly Transition[]]

Parameters

NameTypeDescription
gameGameState

The native game state used to resolve scheduled input.

inputInputSchedulerState

The held-input scheduler state for this logical tick.

actionsreadonly PlayAction[]

Native actions in the scheduler’s canonical order.

applyAction(state: GameState, action: Action) => Transition

The native applyAction function for this game.

Returns

readonly [GameState, InputSchedulerState, readonly Transition[]]

Applies a scheduler batch until the pair locks or the run pauses; accepted actions are recorded by the engine.

Examples

import { applyAction, applyScheduledActions, createGame, createInputScheduler } from "@johnmorrisdotca/houseki/colour-chains";
import type { Action } from "@johnmorrisdotca/houseki/colour-chains";

const state=createGame({seed:"docs"});
const action: Action={kind:"left"};
const input=createInputScheduler();
console.log(applyScheduledActions(state,input,[action],applyAction)[0].phase);
falling

What it prints (run when this page was built)

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