Reference · Rules, solvers and generation
shapedBoardfunction
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 it
import { shapedBoard } from "@johnmorrisdotca/tsunagi";
Definition
function shapedBoard(size: number, keep: (at: number) => boolean, more?: { hex?: boolean; }): TsunagiBoard
Parameters
| Name | Type | Description |
|---|---|---|
size | number | The side of the square it is written in. |
keep | (at: number) => boolean | Whether a cell is on the board. |
more (optional) | { hex?: boolean; } | Whether it is a honeycomb. |
Returns
TsunagiBoard
The board as a graph.
Examples
import { shapedBoard } from "@johnmorrisdotca/tsunagi";
console.log(shapedBoard(5,(at)=>at%5!==2||at>=10).cells.length);23What it prints (run when this page was built)