Reference · Rules, solvers and generation
squareBoardfunction
A square board, its edges joined if wrap, with any blocked cells.
Import it
import { squareBoard } from "@johnmorrisdotca/tsunagi";
Definition
function squareBoard(side: number, more?: { wrap?: boolean; blocked?: ReadonlySet<number>; }): TsunagiBoard
Parameters
| Name | Type | Description |
|---|---|---|
side | number | The number of cells on each side. |
more (optional) | { wrap?: boolean; blocked?: ReadonlySet<number>; } | Whether the edges join, and the cells no line enters. |
Returns
TsunagiBoard
The board as a graph.
Examples
import { squareBoard } from "@johnmorrisdotca/tsunagi";
console.log(squareBoard(5,{wrap:true}).around[0]);[ 20, 1, 5, 4 ]What it prints (run when this page was built)