Reference · Shizen and Arashi environments
previewPowerDropfunction
Preview a single normal landing and, for a power drop, at most one validated one-cell rebound.
Import it
import { previewPowerDrop } from "@johnmorrisdotca/houseki/nature";
Definition
function previewPowerDrop(state: NatureState, request: PowerDropRequest): PowerDropPreview
Parameters
| Name | Type | Description |
|---|---|---|
state | NatureState | The immutable native state to read or transition; the input is retained. |
request | PowerDropRequest | The native falling piece, pivot id and power/rebound choice. |
Returns
PowerDropPreview
Preview a single normal landing and, for a power drop, at most one validated one-cell rebound.
Examples
import { createNatureState, previewPowerDrop } 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(previewPowerDrop(state,request).finalCells.length);1What it prints (run when this page was built)