Bounded peg-solitaire solving, reverse generation and replay verification
oo. -- jump 0 --> ..ogit clone https://github.com/kekeshuo/moonpeg.git
cd moonpegmoon check --deny-warn
moon test
moon run examples/solve --target wasm-gc
moon build --target js --release
node scripts/moonpeg.cjs examples/requests/triangle.json
node scripts/examples.cjs{"name":"local/my_puzzle","deps":{"kekeshuo/moonpeg":{"path":"../moonpeg"}}}let (board, start) = @peg.parse_board("oo.")
match board.solve(start, AnySingle, 100).outcome {
Solved(moves) => assert_true(board.verify_solution(start, moves, AnySingle))
Unsolvable => abort("no solution")
Exhausted => abort("unknown: increase budget")
}| Area | Contract |
|---|---|
| Boards | Width/height 1..8; ASCII; LF/CRLF, optional final LF; no bare CR |
| Moves | Orthogonal axes; triangular adds (1,1). Deterministic zero-based IDs |
| Goals | Any singleton or exact nonempty occupancy on the same topology |
| Search | 0..1000000 expanded non-goal nodes; goal checks/cache hits are free |
| Results | Solved includes a replayable path; Unsolvable means exhaustive proof; Exhausted means unknown |
| Generation | Up to holes-minus-goal-pegs inverse jumps; may stop early; no uniformity/difficulty claim |
| Certificates | At most 63 jumps; illegal step gives a zero-based transcript diagnostic |
| Transport | JSON: 16384 code units/depth 16; CLI: 65536 UTF-8 bytes; no lossy UInt64 payloads |
python scripts/verify.py
# Explicitly record unverified native runtime when no C compiler is installed:
python scripts/verify.py --skip-native-runtimeInstall
Download zipBounded peg-solitaire solving, reverse generation and replay verification