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

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

3.8 kB minified and gzipped, with everything it imports (measured with esbuild)

Exports

NameKindWhat it is
BoardtypeImmutable hole lattice and all legal jump triples for a board.
boardOffunctionA familiar lattice or a shaped outline.
CelltypeA hole's stable coordinate within a board shape, independent of its drawing.
ChallengetypeA starting position paired with its complete legal witness and seed.
ChallengeDifficultytypeRequested witness length category; this is not a measured human rating.
challengeOffunctionGenerates a seeded challenge on a built-in shape, optionally fixing its final hole.
ChallengePacktypeCurated goal choices for one supported board shape.
classicEnglishfunctionReturns the classic centre-empty English game with its complete solution.
classicTrianglefunctionReturns the full triangle with the apex empty and any final hole accepted.
GametypeImmutable peg position, target, move history, and assistance marker.
gameCodefunctionVersioned save: replay, rather than accepting a claimed final position.
gameFromCodefunctionValidates and replays a versioned save string, returning null if invalid.
generatefunctionGrow backward from one peg.
generateTobiishiChallengefunctionCreates one fixed-goal puzzle with a complete, replayable legal answer.
GoalChallengetypeGenerated puzzle augmented with its pack, goal, and requested length category.
GoalHoletypeNamed goal hole and its localized menu labels.
isGameSolvedfunctionChecks whether one peg remains at the required target, if any.
isGameStuckfunctionChecks whether no legal continuation remains before the goal is reached.
JumptypeA legal solitaire jump from an occupied hole over a peg to an empty hole.
jumpAtfunctionInvalid jumps leave a game unchanged; a valid jump removes exactly one peg.
legalJumpsfunctionLists legal jumps from the current position.
makeBoardfunctionMake a board from holes and a lattice; absent holes cannot be crossed.
markHelpedfunctionMark an assisted run without changing pieces or history.
newGamefunctionCreates a validated immutable position with the given target hole, if any.
pegCountfunctionCounts pegs remaining on the board.
rectangleBoardfunctionCreates a square-lattice rectangle, including supported wide and tall boards.
restartfunctionRestores the original peg arrangement and clears moves and assistance.
seededRandomfunctionCreates a deterministic pseudo-random stream from a text seed.
ShapetypeBuilt-in board outlines supported by the player and challenge packs.
SHAPESconstantBuilt-in shape names in player-menu order.
SolutiontypeBounded search result; limit distinguishes unfinished search from proof.
solvefunctionA bounded depth-first proof search.
SQUARE_STEPSconstantOrthogonal direction steps used by square-lattice boards.
TOBIISHI_CHALLENGE_PACKSconstantNamed challenge pack metadata; each goal is a distinct hole with a legal witness.
TRIANGLE_STEPSconstantSix jump directions used by the triangular lattice.
undofunctionReturns the previous position, or the same game when history is empty.
VERSIONconstantCurrent package API version.

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