oneshotlm
Compare all models on this prompt →

Maze generator & solver · glm-4.5

Output generated Cost / run $0.0138 Runtime 91.5s

Prompt for this run

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 ↗

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-4.5
vendorZ.ai · GLM
harnesspi-agent
generated2026-08-01

METRICS

runtime91.5s
tokens in7.4k
tokens out4.8k
cached2.6k
cost / run$0.0138
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
2. Displays it on a canvas
3. Animates either A* or BFS solver finding the path from start to finish
4. All in one index.html file with inline CSS and JS
5. No external resources, CDNs, or network requests

Let me create this complete application:

1. HTML structure with a canvas element
2. CSS for styling
3. JavaScript for:
   - Maze generation using recursive backtracker
   - Pathfinding using A* (I'll use A* as it's more interesting)
   - Animation of the solving process

Let me write this out:

I'll create a single-page web app with a maze generator and animated solver. Let me build this complete application:

→ write /tmp/ws/index.html (18736 bytes)
toolResult

Successfully wrote 18736 bytes to /tmp/ws/index.html

assistant
thinking
Done! I've created a complete single-page web app that:

1. **Generates random mazes** using the recursive backtracker algorithm
2. **Displays the maze** on an HTML5 canvas
3. **Solves the maze** using the A* (A-Star) pathfinding algorithm with animated visualization
4. **All in one self-contained file** with inline CSS and JavaScript
5. **No external resources** - runs completely sandboxed with no network requests

Key features:
- Adjustable maze size (10-50 cells)
- Adjustable animation speed
- Visual feedback during generation and solving
- Color-coded legend (start, end, exploring, path)
- Statistics showing cells explored and path length
- Smooth animations with configurable speed
- Modern dark UI with gradients and hover effects
- The recursive backtracker creates perfect mazes (no loops, one unique path between any two points)
- A* algorithm with Manhattan distance heuristic for efficient pathfinding

I've created a complete single-page maze generator and solver web app. Here's what it includes: **Features:** - **Maze Generation**: Uses the recursive backtracker algorithm to create perfect mazes (no loops, one unique path between any two points) - **Maze Solving**: Uses A* pathfinding with Manhattan distance heuristic for efficient solving - **Animated Visualization**: Watch both generation and solving processes in real-time - **Interactive Controls**: - Adjustable maze size (10-50 cells) - Adjustable animation speed - **Visual Feedback**: - Color-coded cells (green=start, red=end, yellow=exploring, blue=path) - Progress indicators - Statistics showing cells explored and final path length **UI Design:** - Modern dark theme with gradients - Smooth hover effects on buttons - Responsive layout - Legend showing color meanings The app runs completely offline with no external dependencies or network requests. Open `index.html` in a browser to start generating and solving mazes!