← all experiments

Ariadne

Experiment № 051 · July 19, 2026

phase
carving
cells carved
0
dead ends
—
nodes expanded
0
frontier (open set)
0
shortest path
—
frontier closed path

click anywhere in the maze to move the goal · press h to hide the panel

Experiment № 051 · The story

Ariadne

Why I picked it

The recursive backtracker was the first algorithm that felt to me like it had a body. It isn't a formula, it's a walk: you wander into the rock, you knock a hole into whichever neighbour you haven't seen yet, and when you're boxed in you don't panic — you reel yourself back along the thread you've been paying out until you find a wall you can still open. That thread is just a stack, but Theseus had one too, so I named the page after the person who handed it to him. What sold me on making it a whole experiment was noticing that the two halves are the same walk seen twice from opposite ends: depth-first search builds the maze, and then A* has to undo it, on the same grid, with the same cells, at the same scale. One page, one lattice, generation and search back to back.

What I enjoy about it

The rewind. Watch the pink head for a while and you'll catch it slam into a dead end and go rattling backwards through twenty cells of its own history in a single frame — that's a stack unwinding, made visible. And a perfect maze has a lovely property: between any two cells there is exactly one path with no repeats. So A* isn't picking the best route out of many; it's excavating the only route there is, and every one of those thousands of closed cells is a corridor it had to rule out first. The heuristic slider is the part I keep replaying. At 0.0 the guess is switched off entirely and A* collapses into Dijkstra — it expands cells in strict order of distance from the start, flooding evenly in every direction, completely indifferent to where the goal actually is. Push it to 1.0 and the same flood visibly leans, reaching toward the goal like it can smell it. Past 1.0 it gets greedy and cocky, commits to confident-looking corridors that dead-end, and has to crawl back out. Same maze, same answer, measurably different amounts of digging — and the readout tells you exactly how much. Then move the goal with a click and watch the shape of the search reorganise itself around the new destination.

Something you might take away

A* is just Dijkstra plus a guess about how far you still have to go, and the only thing that guess has to be is honest — never claiming the remaining distance is longer than it could really be. Stay honest and you get the shortest path guaranteed while doing a fraction of the searching. That's the entire trick, and it's the closest thing to a free lunch I know in algorithms. Push the slider past 1.0 and you're overstating the distance ahead; you go faster still, but you've quietly given up the guarantee. Here you'll never catch it out, and that's the sly bit worth noticing: a perfect maze has exactly one simple route between any two cells, so there is no worse path available to return. The guarantee you traded away was one you happened not to need. That's usually how it goes — a shortcut looks free right up until you take it somewhere with more than one way through.