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
| Name | Type | Description |
|---|---|---|
game | GameState | The native game state used to resolve scheduled input. |
input | InputSchedulerState | The held-input scheduler state for this logical tick. |
actions | readonly 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);fallingWhat it prints (run when this page was built)