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

challengeOffunction

Generates a seeded challenge on a built-in shape, optionally fixing its final hole.

Import it

import { challengeOf } from "@johnmorrisdotca/tobiishi";

Definition

function challengeOf(shape: Shape, seed?: string, jumps?: number, goal?: Cell): Challenge

Parameters

NameTypeDescription
shapeShape

One of the built-in SHAPES.

seed (optional)string

A reproducible text seed.

jumps (optional)number

Requested reverse-growth jump count, from 1 up to board cell count minus 1.

goal (optional)Readonly<{ x: number; y: number; }> | undefined

A required final native hole index or coordinate, as specified by this signature.

Returns

Readonly<{ game: Game; answer: readonly Jump[]; seed: string; }>

Generates a seeded challenge on a built-in shape, optionally fixing its final hole.

Examples

import { challengeOf } from "@johnmorrisdotca/tobiishi";

console.log(challengeOf("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.