Reference · Boards, rules and challenges
makeBoardfunction
Make a board from holes and a lattice; absent holes cannot be crossed.
Import it
import { makeBoard } from "@johnmorrisdotca/tobiishi";
Definition
function makeBoard(name: string, cells: readonly Cell[], lattice?: Board["lattice"]): Board
Parameters
| Name | Type | Description |
|---|---|---|
name | string | A nonempty native board name of at most 100 characters. |
cells | readonly Readonly<{ x: number; y: number; }>[] | Distinct valid integer-coordinate holes, in stable index order; at most 128. |
lattice (optional) | "triangle" | "square" | The native square or triangular jump lattice. |
Returns
Readonly<{ name: string; lattice: "square" | "triangle"; cells: readonly Cell[]; jumps: readonly Jump[]; }>
Make a board from holes and a lattice; absent holes cannot be crossed.
Examples
import { makeBoard } from "@johnmorrisdotca/tobiishi";
console.log(makeBoard("Three holes",[{x:0,y:0},{x:1,y:0},{x:2,y:0}]).jumps.length);2What it prints (run when this page was built)