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

processInputTickfunction

Applies a complete deterministic held-input and simulation tick, releasing controls on lock or resolution.

Import it

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

Definition

function processInputTick(game: GameState, input: InputSchedulerState, apply: (state: GameState, action: Action) => Transition, tick: (state: GameState, ticks: number) => 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.

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

The native applyAction function for this game.

tick(state: GameState, ticks: number) => Transition

The native advanceTicks function for this game.

Returns

readonly [GameState, InputSchedulerState, readonly Transition[]]

Applies a complete deterministic held-input and simulation tick, releasing controls on lock or resolution.

Examples

import { advanceTicks, applyAction, createGame, createInputScheduler, processInputTick } from "@johnmorrisdotca/houseki/colour-chains";

const state=createGame({seed:"docs"});
const input=createInputScheduler();
console.log(processInputTick(state,input,applyAction,advanceTicks)[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.