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 · Magnetic Blocks

blockCellsfunction

Returns stable-gem addresses after rotating the square block around its centre.

Import it

import { blockCells } from "@johnmorrisdotca/houseki/magnetic-blocks";

Definition

function blockCells(block: Block, width: number): readonly { readonly index: number; readonly gem: Gem; }[]

Parameters

NameTypeDescription
blockBlock

The native active 2×2 block and its stable gem ids.

widthnumber

The native board width in cells.

Returns

readonly { readonly index: number; readonly gem: Gem; }[]

Returns stable-gem addresses after rotating the square block around its centre.

Examples

import { blockCells, createGame } from "@johnmorrisdotca/houseki/magnetic-blocks";

const state=createGame({seed:"docs"});
console.log(blockCells(state.active!,state.settings.width).length);
4

What it prints (run when this page was built)

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