Reference · Boards, rules and challenges
generatefunction
Grow backward from one peg. The reversed jumps are a proof, even on unusual boards.
Import it
import { generate } from "@johnmorrisdotca/tobiishi";
Definition
function generate(board: Board, seed: string, jumps?: number, goal?: number): Challenge
Parameters
| Name | Type | Description |
|---|---|---|
board | Readonly<{ name: string; lattice: "square" | "triangle"; cells: readonly Cell[]; jumps: readonly Jump[]; }> | The validated native board and all its legal jump triples. |
seed | string | A reproducible text seed. |
jumps (optional) | number | Requested reverse-growth jump count, from 1 up to board cell count minus 1. |
goal (optional) | number | undefined | A required final native hole index or coordinate, as specified by this signature. |
Returns
Readonly<{ game: Game; answer: readonly Jump[]; seed: string; }>
Grow backward from one peg. The reversed jumps are a proof, even on unusual boards.
Examples
import { boardOf, generate } from "@johnmorrisdotca/tobiishi";
console.log(generate(boardOf("triangle"),"sample",3).answer.length);3What it prints (run when this page was built)