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

Challengetype

A starting position paired with its complete legal witness and seed.

Import it

import type { Challenge } from "@johnmorrisdotca/tobiishi";

Definition

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

Members

NameTypeDescription
gameReadonly<{ board: Board; start: readonly boolean[]; pegs: readonly boolean[]; target: number | null; history: readonly Jump[]; helped: boolean; }>
answerreadonly Readonly<{ from: number; over: number; to: number; }>[]
seedstring

Examples

import type { Challenge } from "@johnmorrisdotca/tobiishi";
import { classicTriangle } from "@johnmorrisdotca/tobiishi";

const value: Challenge = classicTriangle();
console.log(value);
{
  game: {
    board: {
      name: 'triangle',
      lattice: 'triangle',
      cells: [Array],
      jumps: [Array]
    },
    start: [
      false, true, true, true,
      true,  true, true, true,
      true,  true, true, true,
      true,  true, true
    ],
    pegs: [
      false, true, true, true,
      true,  true, true, true,
      true,  true, true, true,
      true,  true, true
    ],
    target: null,
    history: [],
    helped: false
  },
  answer: [
    { from: 3, over: 1, to: 0 },
    { from: 5, over: 4, to: 3 },
    { from: 0, over: 2, to: 5 },
    { from: 6, over: 3, to: 1 },
    { from: 9, over: 5, to: 2 },
    { from: 11, over: 7, to: 4 },
    { from: 12, over: 8, to: 5 },
    { from: 1, over: 4, to: 8 },
    { from: 2, over: 5, to: 9 },
    { from: 14, over: 9, to: 5 },
    { from: 5, over: 8, to: 12 },
    { from: 13, over: 12, to: 11 },
    { from: 10, over: 11, to: 12 }
  ],
  seed: 'classic-triangle'
}

What it prints (run when this page was built)

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