oneshotlm
Compare all models on this prompt →

Mandelbrot explorer · glm-5.3

Output generated Cost / run $0.0226 Runtime 41.0s

Prompt for this run

Render the Mandelbrot set with a smooth color gradient on a full-screen canvas, with click-and-drag to pan and mouse-wheel to zoom.

⛨ 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-5.3
vendorZ.ai · GLM
harnesspi-agent
generated2026-08-27

METRICS

runtime41.0s
tokens in14k
tokens out3.0k
cached8.4k
cost / run$0.0226
Transcript · 8 messages
user

Render the Mandelbrot set with a smooth color gradient on a full-screen canvas, with click-and-drag to pan and mouse-wheel to zoom.

assistant
thinking
Write a single-file Mandelbrot explorer with smooth coloring, pan, zoom, WebGL or canvas? Use canvas 2D with progressive render and ImageData for speed. Implement double-click? Just wheel zoom at cursor, drag pan, smooth iteration coloring with log-log.
→ write index.html (6779 bytes)
toolResult

Successfully wrote 6779 bytes to index.html

assistant
thinking
I left messy dead code in the inner loop (the broken placeholder loop). Clean it up.

Let me clean up some leftover dead code in the inner loop:

→ edit {"edits":[{"newText":" let sm = 0;\n if (!inside) {\n const r2Limit = 1e8; // big bailout => smoother log-log c
toolResult

Successfully replaced 1 block(s) in index.html.

assistant
→ bash {"command":"node -e \"\nconst s = require('fs').readFileSync('index.html','utf8');\nconst m = s.match(/<script>([\\s\\S]*)<\\/script>/);\nne
toolResult

syntax OK -rw-r--r-- 1 node node 6381 Aug 27 00:50 index.html

assistant

Done — `index.html` (self-contained, no external resources) contains a full-screen Mandelbrot explorer: - **Rendering**: escape-time iteration with a large bailout radius and the log-log smooth coloring formula (`n + 1 − log₂(log₂|z|)`), fed into a cyclic cosine RGB palette for banding-free gradients. Set interior uses a cardioid/period-2 bulb shortcut, and rendering is chunked via `requestAnimationFrame` so the UI stays responsive. - **Pan**: click-and-drag (pointer events, works with touch too), with an instant shifted blit of the existing bitmap for feedback, followed by a fresh render. - **Zoom**: mouse wheel zooms centered on the cursor, with the iteration budget scaling automatically with zoom depth (up to 20,000). - **Extras**: HUD showing zoom, center coordinates, and iteration count; press `R` to reset the view.