oneshotlm
Compare all models on this prompt →

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.

⛨ sandboxed Open in new tab ↗
transcript · 4 messages
user

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.

assistant
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.
write /workspace/index.html (21359 bytes)
toolResult

Successfully wrote 21359 bytes to /workspace/index.html

assistant
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

modelglm-5
vendorZ.ai · GLM
harnesspi-agent
generated2026-07-22

EVALUATION

3/5 partial

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.

idle motion0.2%
on click0.2%
on drag0.2%
on wheel2.4%
on enter + space8.8%
on arrow keys9.3%
on w/a/s/d0.0%
frame spread19.2 / 255
console errors0
js errors none

METRICS

runtime73.5s
tokens in5.1k
tokens out5.3k
cached2.8k
cost / run$0.0135