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
| Name | Type | Description |
|---|---|---|
board | readonly (Gem | null)[] | The row-major native board; null cells are empty or masked. |
bonds | readonly Bond[] | Native stable-id bonds connecting surviving gems. |
indices | readonly 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);0What it prints (run when this page was built)