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 · Shizen and Arashi environments

applyPowerDropfunction

Commit a previewed landing as one immutable operation. A failed preview leaves the original state untouched.

Import it

import { applyPowerDrop } from "@johnmorrisdotca/houseki/nature";

Definition

function applyPowerDrop(state: NatureState, request: PowerDropRequest): NatureTransition

Parameters

NameTypeDescription
stateNatureState

The immutable native state to read or transition; the input is retained.

requestPowerDropRequest

The native falling piece, pivot id and power/rebound choice.

Returns

NatureTransition

Commit a previewed landing as one immutable operation. A failed preview leaves the original state untouched.

Examples

import { applyPowerDrop, createNatureState } from "@johnmorrisdotca/houseki/nature";
import type { PowerDropRequest } from "@johnmorrisdotca/houseki/nature";

const state=createNatureState({width:4,height:4,seed:"docs"});
const request:PowerDropRequest={piece:[{id:1,kind:"stone",colour:"red",x:1,y:0}],pivotId:1,power:true};
console.log(applyPowerDrop(state,request).accepted);
true

What it prints (run when this page was built)

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