Skip to the content

Tobiishi飛び石

Jump pegs on nine native boards, generate seeded solvable challenges and build a peg-solitaire player for your page.

Tobiishi is the Japanese word 飛び石 for stepping stones. About the name

Contents

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

NameTypeDescription
boardReadonly<{ name: string; lattice: "square" | "triangle"; cells: readonly Cell[]; jumps: readonly Jump[]; }>

The validated native board and all its legal jump triples.

seedstring

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);
3

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tobiishi 0.3.1.