Hazel activities

Small apps whose rules are written in Hazel, a typed functional language with a live editor, and run in the page by hazeljs, each shown beside the program it runs. Each works on a phone, and with no connection once opened.

Ancient oracles 路 One-player games 路 Hazel AI opponents 路 Automata

馃摬 All of them on a tablet or phone: one icon, with no connection

Ancient oracles

I Ching

The Book of Changes: six lines cast by coins or yarrow

Tarot

78 cards, dealt into a spread and turned one by one

Astrology

A birth chart, and today's sky against it

One-player games

Solitaire

Klondike: the deal, every move and the win, in Hazel

Minesweeper

The mines, the counts, the opening and a 馃挕 hint, in Hazel

Mahjong solitaire

144 tiles in layers; which are free, a deal that can always be won, and Hazel's own play, in Hazel

Snake

Steer to the apple and grow, level by level, to the golden apple and a party: each step, and a robot that plays it, in Hazel

Star wave

Send hearts up to visitors turning the town rainbow, the last just as it is all rainbow: each step, and a robot, in Hazel

Butterfly garden

Feed caterpillars nectar and they turn to butterflies that open the garden's flowers: each step, and a robot, in Hazel

Gnome dig

A gnome with a lantern digs for gems, minding the monsters, the animals and the ground water: each step, and a robot, in Hazel

Gnome world

A world thirty-two screens across, from the deep rock to tree houses three times as tall, as Dad, Mom, the girl or the boy: run, jump, climb, dig and swim; rivers, beavers' dams, a village under a hill, water seeping through the ground, frogs on the lily pads, birds in the trees and on the water; planned in Hazel, every step compiled by hazel-jit; an instruction booklet to print

Hazel AI opponents

Games against an opponent whose choice of move is a Hazel program too, shown beside the board with the rules.

Go

Captures, the ko and the score in Hazel, and Hazel's move

Checkers

Jumps and kings in Hazel, and a Hazel that looks ahead

Mahjong

Hong Kong rules, you against three Hazel players

Light trails

Ride a light that leaves a wall, against Hazel's rider: the rules and the rider in Hazel

Physics simulation

Pinball

Ten tables as Hazel data, and every frame's physics in Hazel

Downhill

Ski an endless slope: its course, every step's physics and a robot skier in Hazel

Bricks

A paddle, a ball and six levels of bricks: the levels as Hazel data, every step's physics in Hazel

Automata

Petri nets

A net and its firing rule in Hazel, edited while it runs

How each one works

The page passes the Hazel program random numbers, a birth's time and place, or a move, and draws what it answers, as Messed Up Dress Up's scripts and a Petri net simulator do.

hazeljs-examples 路 source on GitHub 路 versions 路 Apache 2.0 (code), CC BY 4.0 (words) 路 by Matthew Hammer 路 examples for hazeljs