shapedBoard関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A board of any outline: every cell of the square keep says yes to, and the rest off the board. A hole in the middle
reads as blocked cells, since it does not reach the edge (offBoardCells).
インポート
import { shapedBoard } from "@johnmorrisdotca/tsunagi";
定義
function shapedBoard(size: number, keep: (at: number) => boolean, more?: { hex?: boolean; }): TsunagiBoard
引数
| 名前 | 型 | 説明 |
|---|---|---|
size | number | The side of the square it is written in. |
keep | (at: number) => boolean | Whether a cell is on the board. |
more (省略可) | { hex?: boolean; } | Whether it is a honeycomb. |
戻り値
TsunagiBoard
The board as a graph.
例
import { shapedBoard } from "@johnmorrisdotca/tsunagi";
console.log(shapedBoard(5,(at)=>at%5!==2||at>=10).cells.length);23出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。