Pure Standard ML classic puzzle solvers: N-Queens (count + one solution), Tower of Hanoi (move sequence), 15-puzzle solvability, Lights Out (GF(2) solver), and Peg Solitaire (DFS).
No dependencies. Byte-identical under MLton and Poly/ML.
=== N-Queens ===
Counts n=1..8: 1,0,0,2,10,4,40,92
One solution for 6: [4,2,0,5,3,1]
=== Tower of Hanoi (3 discs) ===
7 moves:
peg 0 -> peg 2
peg 0 -> peg 1
peg 2 -> peg 1
peg 0 -> peg 2
peg 1 -> peg 0
peg 1 -> peg 2
peg 0 -> peg 2
=== 15-puzzle solvability ===
Solved state: solvable
=== Lights Out (press pattern for all-on 5x5) ===
Solution: press 15 buttons
val queensCount : int -> int
val queensOne : int -> int list option
val hanoi : int -> (int * int) list
val fifteenSolvable : int -> int list -> bool
val lightsOutSolve : bool list -> bool list option
val pegSolitaireSolve : unit -> (int * int * int) list optionmake test && make test-poly && make example11 deterministic checks: N-Queens counts 1,0,0,2,10,4,40,92 (n=1..8), hanoi(3)=7, 15-puzzle solvability parity, Lights Out all-on/all-off, peg solitaire solution found.
MIT. See LICENSE.