Maze generator & solver · claude-opus-4.8
Output generated Cost / run $0.2001 Runtime 61.2s
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.
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
METRICS
Transcript · 6 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
I'll create a standalone HTML file that contains everything needed.
/workspace/index.html (11842 bytes)Successfully wrote 11842 bytes to /workspace/index.html
{"command":"cd /workspace && node -e \"const fs=require('fs');const h=fs.readFileSync('index.html','utf8');console.log('bytes',h.length,'hasbytes 11842 has script true has style true
Done. `index.html` is a self-contained single-file app with no external resources. **Features:** - **Maze generation** using an iterative recursive-backtracker, animated as the "carver" (pink head) tunnels through the grid. - **Solver** with a dropdown to choose **A\*** (Manhattan heuristic) or **BFS**, animated live: - blue = visited/closed cells - orange = frontier/open cells - teal line = the final reconstructed path from top-left (start) to bottom-right (finish). - **Controls:** maze size, animation speed, New Maze, and Solve. - Status bar reports path length and cells explored. Just open it in a browser — it renders a maze immediately, and clicking **Solve** animates the search.