oneshotlm
Compare all models on this prompt →

Maze generator & solver · qwen3.8-max

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 · 12 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
Write a single index.html with maze generation using recursive backtracker and animated solving with A*. Polish it up nicely.
write /tmp/ws/index.html (12451 bytes)
toolResult

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

assistant
thinking
Verify syntax quickly with node if available.
bash {"command":"cd /tmp/ws && node -e \"\nconst html = require('fs').readFileSync('index.html','utf8');\nconst js = html.match(/<script>([\\s\\S
toolResult

JS syntax OK -rw-r--r--. 1 node node 12474 Aug 3 23:54 index.html

assistant
thinking
I noticed there's a weird line in draw(): `ctx.arc(pad + GOAL.r !== undefined ? ... : 0, ...)` — this is sloppy ternary operator precedence. `pad + GOAL.r !== undefined` evaluates as `(pad + GOAL.r) !== undefined`, which is always true, so the true branch always gets executed — it's harmless, but let's clean it up.

Let me fix one sloppy line in the goal-marker drawing:

edit {"path":"/tmp/ws/index.html","edits":[{"oldText":" ctx.arc(pad + GOAL.r !== undefined ? pad + GOAL.c * cellPx + cellPx / 2 : 0,\n
toolResult

Successfully replaced 1 block(s) in /tmp/ws/index.html.

assistant
thinking
Let's verify the fix is syntactically valid.
bash {"command":"cd /tmp/ws && node -e \"\nconst html = require('fs').readFileSync('index.html','utf8');\nconst js = html.match(/<script>([\\s\\S
toolResult

JS syntax OK after edit -rw-r--r--. 1 node node 12441 Aug 3 23:54 index.html

assistant
thinking
Let me actually do a more thorough test — run the maze generation and solver headlessly to verify the logic works end-to-end. Let me extract the core logic and test it. Actually, the generation and solve functions reference globals. Let me do a quick functional test of the algorithm logic itself.

Let me do a real end-to-end logic test of the maze generation and A* solver:

bash {"command":"cd /tmp/ws && node -e \"\n// Extract and test the core algorithms headlessly\nlet N, grid;\nfunction generateMaze(n){\n const g
toolResult

15x15 connected=true A* path=72 BFS path=72 match=true 25x25 connected=true A* path=286 BFS path=286 match=true 41x41 connected=true A* path=542 BFS path=542 match=true 61x61 connected=true A* path=748 BFS path=748 match=true

assistant
thinking
All tests passed: mazes are fully connected (perfect mazes via recursive backtracking), and both A* and BFS find the path of the same optimal length (in a perfect maze the path is unique). index.html exists. Done.

Done. `index.html` is at `/tmp/ws/index.html` — a fully self-contained single-page app with no external resources. **What it does:** - **Maze generation** — Recursive backtracker (iterative DFS with an explicit stack), producing a perfect maze with walls drawn on a canvas. Verified fully connected for all sizes. - **Solver** — Both **A\*** (with Manhattan heuristic, binary-heap priority queue) and **BFS**, selectable via dropdown. Tested headlessly: both find identical optimal paths on every generated maze. - **Animation** — Explored cells fill in blue as the algorithm runs, then the solution path traces back in cyan from start (green) to finish (red). - **Controls** — New Maze button, Solve button, maze size (15×15 to 61×61), algorithm picker, and a speed slider; live status shows cells explored and final path length. - Crisp rendering via devicePixelRatio scaling, responsive canvas, dark theme with a legend. All CSS is in a `<style>` tag and all JS in a `<script>` tag — no separate files, no network requests.

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

modelqwen3.8-max
vendorQwen
harnesspi-agent
generated2026-08-03

EVALUATION

3/5 partial

Maze generator/solver renders a static maze; Enter+Space triggers UI change (legend, finish marker) but click/drag/wheel/arrows/WASD show no visible effect.

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.0%
on click0.0%
on drag0.0%
on wheel0.0%
on enter + space21.2%
on arrow keys0.0%
on w/a/s/d0.0%
frame spread17.4 / 255
console errors0
js errors none

METRICS

runtime117.2s
tokens in36k
tokens out6.6k
cached24k
cost / run$0.0688