Maze generator & solver · glm-5
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 me to create a single-page web app that:
1. Generates a random maze using the recursive-backtracker algorithm on a canvas
2. Animates an A* or BFS solver finding the path from start to finish
I'll create this all in one index.html file with inline CSS and JS. Let me plan this out:
1. Canvas setup with appropriate styling
2. Recursive backtracker algorithm for maze generation:
- Start with a grid of cells, all walls
- Pick a starting cell, mark it as visited
- While there are unvisited cells:
- If current cell has unvisited neighbors, choose one randomly
- Remove wall between current and chosen neighbor
- Push current cell to stack
- Make chosen neighbor the current cell
- If no unvisited neighbors, pop from stack
3. A* or BFS pathfinding:
- BFS is simpler, A* is more efficient
- I'll implement A* with Manhattan distance heuristic
- Animate the exploration process
4. Animation controls and visual feedback
Let me write this complete solution./workspace/index.html (21359 bytes)Successfully wrote 21359 bytes to /workspace/index.html
thinking
I've created the index.html file with a complete maze generator and solver. Let me verify it exists and is properly formatted.
I've created a complete maze generator and solver in `/workspace/index.html`. Here's what it includes: ## Features **Maze Generation (Recursive Backtracker)** - Creates a perfect maze with no loops using an iterative approach - Animated generation showing the current cell being carved - All cells are guaranteed to be reachable **Two Solving Algorithms:** 1. **BFS (Breadth-First Search)** - Explores level by level, guaranteed to find shortest path 2. **A* (A-Star)** - Uses Manhattan distance heuristic to find the path more efficiently **Controls:** - **Generate Maze** - Creates a new random maze - **Solve (BFS)** - Finds path using breadth-first search - **Solve (A*)** - Finds path using A* algorithm - **Speed slider** - Controls animation speed - **Size slider** - Adjusts maze size (10x10 to 50x50) **Visual Legend:** - 🟫 Dark walls - ⬛ Open paths - 🟢 Start position (top-left) - 🔴 End position (bottom-right) - 🔵 Explored cells - 🟡 Solution path **Stats displayed:** - Number of cells explored - Final path length The maze generates automatically on load. Click either solver to watch the algorithm explore and find the solution!
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 generation works and animates, but no solver (BFS/A*) run was captured showing pathfinding animation.
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.