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

removeIdsfunction

Remove the selected native cell indices and discard bonds whose endpoint gems were removed.

Import it

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

Definition

function removeIds(board: readonly (Gem | null)[], bonds: readonly Bond[], indices: readonly number[]): { readonly board: readonly (Gem | null)[]; readonly bonds: readonly Bond[]; readonly ids: readonly number[]; }

Parameters

NameTypeDescription
boardreadonly (Gem | null)[]

The row-major native board; null cells are empty or masked.

bondsreadonly Bond[]

Native stable-id bonds connecting surviving gems.

indicesreadonly number[]

Row-major cell indices selected for removal.

Returns

{ readonly board: readonly (Gem | null)[]; readonly bonds: readonly Bond[]; readonly ids: readonly number[]; }

Remove the selected native cell indices and discard bonds whose endpoint gems were removed. Nested null values denote empty board cells, absent active pieces, unselected tools or outcomes not yet reached; optional undefined fields are absent until applicable.

Examples

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

const state=createGame({seed:"docs"});
console.log(removeIds(state.board,state.bonds,[]).ids.length);
0

What it prints (run when this page was built)

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