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

GoalChallengetype

Generated puzzle augmented with its pack, goal, and requested length category.

Import it

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

Definition

type GoalChallenge = Challenge & Readonly<{
    pack: Shape;
    packTitle: string;
    difficulty: ChallengeDifficulty;
    goal: GoalHole;
}>;

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
packShape
packTitlestring
difficultyChallengeDifficulty
goalReadonly<{ id: string; names: Readonly<Record<"en" | "ja", string>>; x: number; y: number; }>

Examples

import type { GoalChallenge } from "@johnmorrisdotca/tobiishi";
import { generateTobiishiChallenge } from "@johnmorrisdotca/tobiishi";

const value: GoalChallenge = generateTobiishiChallenge("english","centre","easy");
console.log(value);
{
  game: {
    board: {
      name: 'english',
      lattice: 'square',
      cells: [Array],
      jumps: [Array]
    },
    start: [
      false, false, false, false, true,
      false, false, false, false, true,
      false, false, false, false, true,
      false, false, true,  false, false,
      false, false, false, false, false,
      false, false, false, false, false,
      false, false, false
    ],
    pegs: [
      false, false, false, false, true,
      false, false, false, false, true,
      false, false, false, false, true,
      false, false, true,  false, false,
      false, false, false, false, false,
      false, false, false, false, false,
      false, false, false
    ],
    target: 16,
    history: [],
    helped: false
  },
  answer: [
    { from: 4, over: 9, to: 16 },
    { from: 17, over: 16, to: 15 },
    { from: 14, over: 15, to: 16 }
  ],
  seed: 'tobiishi-pack:english:centre:easy',
  pack: 'english',
  packTitle: 'Crossroads',
  difficulty: 'easy',
  goal: { id: 'centre', names: { en: 'Centre', ja: '中央' }, x: 3, y: 3 }
}

What it prints (run when this page was built)

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