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

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

NameTypeDescription
namestring

A nonempty native board name of at most 100 characters.

cellsreadonly 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);
2

What it prints (run when this page was built)

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