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

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

NameTypeDescription
namestring
lattice"triangle" | "square"
cellsreadonly Readonly<{ x: number; y: number; }>[]
jumpsreadonly 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)

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