本文へ移動

Houseki宝石

5つの宝石と石のゲームの仕組みを使い、測定したチャレンジやレッスンで遊び、再現できるゲームを保存できます。

宝石(ほうせき)は、宝石や貴石を意味する日本語です。 名前について(英語)

目次

リファレンス · 磁石ブロック

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[]; }

引数

名前型説明
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.

戻り値

{ 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

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/houseki 0.4.2 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。