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 · Native peg-solitaire player

MountOptionstype

Initial puzzle, display choices, optional settings host, and persistence callback.

Import it

import type { MountOptions } from "@johnmorrisdotca/tobiishi/play";

Definition

type MountOptions = {
    game?: Game;
    challenge?: Challenge;
    shape?: Shape;
    seed?: string;
    challengeJumps?: number;
    language?: Language;
    material?: Material;
    theme?: Partial<Theme>;
    justBoard?: boolean;
    settingsHost?: HTMLElement;
    onChange?: (game: Game, code: string) => void;
};

Members

NameTypeDescription
game (optional)Readonly<{ board: Board; start: readonly boolean[]; pegs: readonly boolean[]; target: number | null; history: readonly Jump[]; helped: boolean; }> | undefined
challenge (optional)Readonly<{ game: Game; answer: readonly Jump[]; seed: string; }> | undefined
shape (optional)Shape | undefined
seed (optional)string | undefined
challengeJumps (optional)number | undefined
language (optional)"en" | "ja" | undefined
material (optional)Material | undefined
theme (optional)Partial<Theme> | undefined
justBoard (optional)boolean | undefined
settingsHost (optional)HTMLElement | undefined
onChange (optional)((game: Game, code: string) => void) | undefined

Examples

import { makeBoard, newGame } from "@johnmorrisdotca/tobiishi";
import type { MountOptions } from "@johnmorrisdotca/tobiishi/play";

const board = makeBoard("Three holes",[{x:0,y:0},{x:1,y:0},{x:2,y:0}]);
const game = newGame(board,[true,true,false],2);
const value: MountOptions = {game,language:"ja",material:"glass"};
console.log(value);
{
  game: {
    board: {
      name: 'Three holes',
      lattice: 'square',
      cells: [Array],
      jumps: [Array]
    },
    start: [ true, true, false ],
    pegs: [ true, true, false ],
    target: 2,
    history: [],
    helped: false
  },
  language: 'ja',
  material: 'glass'
}

What it prints (run when this page was built)

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