Maze generator & solver · glm-5.2
Generate a random maze with the recursive-backtracker algorithm on a canvas, then animate an A-star or BFS solver finding the path from start to finish.
transcript · 4 messages
Generate a random maze with the recursive-backtracker algorithm on a canvas, then animate an A-star or BFS solver finding the path from start to finish.
thinking
The user wants a self-contained HTML file with a maze generator (recursive backtracker) and an A-star/BFS solver animation on canvas. Let me build this.
I'll build a self-contained maze app with a recursive-backtracker generator and an animated A* solver.
/workspace/index.html (25893 bytes)Successfully wrote 25893 bytes to /workspace/index.html
I've built a complete self-contained maze app in `/workspace/index.html`. Here's what it does: **Generation — Recursive Backtracker** - Carves passages on an odd grid (odd cols/rows so walls align nicely) - Each cell stores wall bits (N/S/E/W); fresh cells start fully walled - A stack-based DFS picks a random unvisited neighbor, knocks down the shared wall, pushes the current cell, and continues; backtracks on dead ends - Animated with the current cell highlighted orange, the backtracking stack shown faintly, and visited cells shaded **Solving — A* or BFS (your choice)** - A* uses a binary min-heap keyed by `f = g + Manhattan-heuristic`, 4-connectivity through open wall directions - BFS uses a simple FIFO queue - Frontier (open set) shown in blue, visited/closed cells in dark blue, reconstructed solution drawn as a glowing orange line - Live stats: visited count, frontier size, path length, elapsed ms **Controls** - Sliders for columns, rows, and animation speed (slow → turbo, which batches more steps/frame) - `Generate` (new maze), `Solve` (animate), `Step` (advance one solver iteration), `Reset solver` - Algorithm dropdown switches between A* and BFS; changing it mid-solve restarts the solver - Canvas auto-fits to viewport and re-renders on resize Open the file in any browser — it runs fully offline with no external dependencies.
TAKE IT TO CODE
A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.
RUN
EVALUATION
Maze generated correctly but solver never runs; clicking Solve/Generate buttons wasn't triggered by tested inputs so no animation occurs.
Vision grade · anthropic/claude-sonnet-5
MEASUREMENTS
Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.