oneshotlm
Compare all models on this prompt →

Maze generator & solver · gemini-3.1-flash-lite-preview

Output generated Cost / run $0.0049 Runtime 9.8s

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

modelgemini-3.1-flash-lite-preview
vendorGoogle
harnesspi-agent
generated2026-07-22

METRICS

runtime9.8s
tokens in5.1k
tokens out2.4k
cached0
cost / run$0.0049
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
**Defining the Core App**

I'm now zeroing in on the fundamental structure of this single-page HTML application, specifically `index.html`. My focus is on integrating two key features. First, I'll leverage the Recursive Backtracker algorithm to generate a randomized maze. Second, this generated maze needs to be beautifully visualized, and I'm planning to achieve this through an HTML5 `<canvas>` element.


**Adding Pathfinding Logic**

I'm now fully immersed in the pathfinding aspect.  I've decided to go with A* for solving, managing open and closed sets with a simple sorted list for the priority queue.  Manhattan distance will be my heuristic. I've designed functions to generate, solve and render the maze, as well as the pathfinding animation using `requestAnimationFrame`.  I'll add UI controls with the `div#ui` element.


→ write index.html (6071 bytes)
toolResult

Successfully wrote 6071 bytes to index.html

assistant

The maze application is complete and contained within `index.html`. It features a recursive-backtracker generator and an A* pathfinding algorithm that visualizes its search process on the canvas. You can open `index.html` in any modern web browser to view it.