Solitaire, played by Hazel's rules

Hazel activities › one-player games · source on GitHub · hazeljs on npm

Klondike: build the four foundations, each suit from the Ace up to the King. Tap a card to move it where it fits, or drag it; tap the stock to turn cards over. The deal, every legal move and the win are a Hazel program, shown beside the game, and the page asks it before every move.

⏳ Loading Hazel (hazeljs from jsDelivr), whose rules deal and play.

This app needs JavaScript, and a page served over http (python3 -m http.server, then localhost).

The vocabulary every module sees (solitaire/rules/preamble.hz). The listings are text, highlighted, until Edit in Hazel opens each in Hazel's own editor; an edit changes how the next move is judged.

loading preamble.hz…
Cards the 52 cards, their colours, names and counts
loading Cards.hz…
Deal the deck shuffled by the page's random numbers, into seven piles and the stock
loading Deal.hz…
Moves every legal move, the moves from one place, a move made, and the win. The page calls (deal, moves, moves_from, apply, won).
loading Moves.hz…

hazeljs-examples · versions · Apache 2.0 (code), CC BY 4.0 (words, the card back) · the card faces are Adrian Kennard's, CC0 (about them) · by Matthew Hammer · an example for hazeljs