oneshotlm
Compare all models on this prompt →

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

Output generated Cost / run $0.0053 Runtime 19.0s

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
vendorGoogle
harnesspi-agent
generated2026-07-22

METRICS

runtime19.0s
tokens in5.0k
tokens out2.7k
cached0
cost / run$0.0053
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
**Generating Maze Structure**

I'm currently focused on implementing the recursive-backtracker algorithm to generate the maze. My aim is to get the core maze generation logic solid before moving on to pathfinding.

**Developing Maze Generation**

I'm refining the recursive backtracker for maze generation, ensuring it adheres to the single-file, inline-only constraints. My current efforts are on the `Maze` class, specifically the `generate()` method, aiming for a robust core before tackling visualization.

→ write index.html (6505 bytes)
toolResult

Successfully wrote 6505 bytes to index.html

assistant

The web app is ready. It uses the `recursive-backtracker` algorithm to generate a uniform spanning tree (perfect maze) and a `Breadth-First Search (BFS)` algorithm to find the shortest path, both visualized on a `<canvas>` element. You can open `index.html` in any modern web browser to interact with the maze generator and solver. * **Generate New Maze**: Creates a random 20x20 maze. * **Solve (BFS)**: Animates the BFS algorithm exploring the grid, followed by the path reconstruction.