removeIds関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Remove the selected native cell indices and discard bonds whose endpoint gems were removed.
インポート
import { removeIds } from "@johnmorrisdotca/houseki/magnetic-blocks";
定義
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[]; }
引数
| 名前 | 型 | 説明 |
|---|---|---|
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. |
戻り値
{ 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.
例
import { createGame, removeIds } from "@johnmorrisdotca/houseki/magnetic-blocks";
const state=createGame({seed:"docs"});
console.log(removeIds(state.board,state.bonds,[]).ids.length);0出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。