Reference
Boards, rules and challenges
import { … } from "@johnmorrisdotca/tobiishi";
3.8 kB minified and gzipped, with everything it imports (measured with esbuild)
Exports
| Name | Kind | What it is |
|---|---|---|
Board | type | Immutable hole lattice and all legal jump triples for a board. |
boardOf | function | A familiar lattice or a shaped outline. |
Cell | type | A hole's stable coordinate within a board shape, independent of its drawing. |
Challenge | type | A starting position paired with its complete legal witness and seed. |
ChallengeDifficulty | type | Requested witness length category; this is not a measured human rating. |
challengeOf | function | Generates a seeded challenge on a built-in shape, optionally fixing its final hole. |
ChallengePack | type | Curated goal choices for one supported board shape. |
classicEnglish | function | Returns the classic centre-empty English game with its complete solution. |
classicTriangle | function | Returns the full triangle with the apex empty and any final hole accepted. |
Game | type | Immutable peg position, target, move history, and assistance marker. |
gameCode | function | Versioned save: replay, rather than accepting a claimed final position. |
gameFromCode | function | Validates and replays a versioned save string, returning null if invalid. |
generate | function | Grow backward from one peg. |
generateTobiishiChallenge | function | Creates one fixed-goal puzzle with a complete, replayable legal answer. |
GoalChallenge | type | Generated puzzle augmented with its pack, goal, and requested length category. |
GoalHole | type | Named goal hole and its localized menu labels. |
isGameSolved | function | Checks whether one peg remains at the required target, if any. |
isGameStuck | function | Checks whether no legal continuation remains before the goal is reached. |
Jump | type | A legal solitaire jump from an occupied hole over a peg to an empty hole. |
jumpAt | function | Invalid jumps leave a game unchanged; a valid jump removes exactly one peg. |
legalJumps | function | Lists legal jumps from the current position. |
makeBoard | function | Make a board from holes and a lattice; absent holes cannot be crossed. |
markHelped | function | Mark an assisted run without changing pieces or history. |
newGame | function | Creates a validated immutable position with the given target hole, if any. |
pegCount | function | Counts pegs remaining on the board. |
rectangleBoard | function | Creates a square-lattice rectangle, including supported wide and tall boards. |
restart | function | Restores the original peg arrangement and clears moves and assistance. |
seededRandom | function | Creates a deterministic pseudo-random stream from a text seed. |
Shape | type | Built-in board outlines supported by the player and challenge packs. |
SHAPES | constant | Built-in shape names in player-menu order. |
Solution | type | Bounded search result; limit distinguishes unfinished search from proof. |
solve | function | A bounded depth-first proof search. |
SQUARE_STEPS | constant | Orthogonal direction steps used by square-lattice boards. |
TOBIISHI_CHALLENGE_PACKS | constant | Named challenge pack metadata; each goal is a distinct hole with a legal witness. |
TRIANGLE_STEPS | constant | Six jump directions used by the triangular lattice. |
undo | function | Returns the previous position, or the same game when history is empty. |
VERSION | constant | Current package API version. |