absorb関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Joins a short run of cells onto the end of a line beside it, keeping every line clear of itself.
インポート
import { absorb } from "@johnmorrisdotca/tsunagi";
定義
function absorb(run: number[], paths: number[][], owner: Int16Array, around: readonly (readonly number[])[]): boolean
引数
| 名前 | 型 | 説明 |
|---|---|---|
run | number[] | The short run of cells. |
paths | number[][] | The lines so far, one of which may take it. |
owner | Int16Array<ArrayBufferLike> | Which line owns each cell. |
around | readonly (readonly number[])[] | What is beside each cell. |
戻り値
boolean
Whether a line took it.
例
import { absorb } from "@johnmorrisdotca/tsunagi";
const owner = new Int16Array(4).fill(-1);
owner[0] = owner[1] = owner[2] = 0;
console.log(absorb([3],[[0,1,2]],owner,[[1],[0,2],[1,3],[2]]));true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。