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

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

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

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);
1

What it prints (run when this page was built)

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