Reference · Boards, rules and challenges
Boardtype
Immutable hole lattice and all legal jump triples for a board.
Import it
import type { Board } from "@johnmorrisdotca/tobiishi";
Definition
type Board = Readonly<{
name: string;
lattice: "square" | "triangle";
cells: readonly Cell[];
jumps: readonly Jump[];
}>;
Members
| Name | Type | Description |
|---|---|---|
name | string | |
lattice | "triangle" | "square" | |
cells | readonly Readonly<{ x: number; y: number; }>[] | |
jumps | readonly Readonly<{ from: number; over: number; to: number; }>[] |
Examples
import { makeBoard } from "@johnmorrisdotca/tobiishi";
import type { Board } from "@johnmorrisdotca/tobiishi";
const board = makeBoard("Three holes",[{x:0,y:0},{x:1,y:0},{x:2,y:0}]);
const value: Board = board;
console.log(value);{
name: 'Three holes',
lattice: 'square',
cells: [ { x: 0, y: 0 }, { x: 1, y: 0 }, { x: 2, y: 0 } ],
jumps: [ { from: 0, over: 1, to: 2 }, { from: 2, over: 1, to: 0 } ]
}What it prints (run when this page was built)