oneshotlm
Compare all models on this prompt →

Mandelbrot explorer · qwen3.8-27b

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 ↗
transcript · 14 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 index.html with a Mandelbrot renderer. Smooth coloring (log-log or fractional iteration count), pan/zoom, ideally with Web Workers or chunked rendering. Keep it reasonably simple but performant — use ImageData, possibly with chunked rendering via requestAnimationFrame. Write the file.
write /tmp/ws/index.html (7254 bytes)
toolResult

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

assistant
thinking
Quick check: is the file complete? The HUD's zoom display is using 3.5/scale, but the initial scale is width-based... actually, scale is units per pixel. The initial 3.5 means the canvas width spans 3.5 units? scale = 3.5 units per pixel is wrong! scale should be about 3.5/W (in pixel units). I set scale = 3.5 as world units per pixel, but this is a bug — with W~1000, the display would be 3500 units wide. Fix needed: scale = 3.5 / H or 3.5 / W at the time of resize. Better approach: define a reference value for the initial scale. Let's fix it: within resize, if it's the first time, set scale = 3.5 / H (about 3.5 units vertically). Also, maxIter's calculation uses H*scale = 3.5, so it's consistent with this.

The file is written, but I spotted a bug: `scale` is world-units-per-pixel, so it must be set from canvas size at startup. Fixing:

edit {"path":"/tmp/ws/index.html","edits":[{"oldText":" var cx = -0.6;\n var cy = 0;\n var scale = 3.5; // initial: about 3.5 units wide-ish p
toolResult

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

assistant
thinking
Also, the HUD zoom baseline: 3.5/scale, where scale is units per pixel → 3.5 units tall = 3.5/scale pixels... The zoom factor at startup = 3.5 / scale_initial = 3.5 / (3.5/H) = H pixels — weird. Zoom should be relative to initial scale: save scale0 = 3.5/H. Let's fix the HUD: zoom = scale0 / scale.

One more consistency fix — the HUD zoom should be relative to the initial scale:

edit {"edits":[{"newText":" var W = 0, H = 0, firstResize = true, scale0 = 0;","oldText":" var W = 0, H = 0, firstResize = true;"},{"newText":"
toolResult

Could not find edits[2] in /tmp/ws/index.html. The oldText must match exactly including all whitespace and newlines.

assistant
thinking
Did the first two edits fail too? No — "Could not find edits[2]" means all edits fail atomically. Let me check the actual text.
bash {"command":"grep -n \"zoomEl\\|firstResize\\|var W = \" /tmp/ws/index.html"}
toolResult

53: var zoomEl = document.getElementById("zoom"); 59: var W = 0, H = 0, firstResize = true; 154: zoomEl.textContent = (3.5 / scale).toExponential(3) + "×"; 166: if (firstResize) { 168: firstResize = false;

assistant
thinking
The file literally contains "×" (not "\u00d7"). That's the reason why edit[2] failed. The entire edit call failed atomically. Retrying with the actual character.
edit {"edits":[{"newText":" var W = 0, H = 0, firstResize = true, scale0 = 0;","oldText":" var W = 0, H = 0, firstResize = true;"},{"newText":"
toolResult

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

assistant
thinking
Verify the syntax with node (extract the script?). Simple sanity check: parse with node.

Quick syntax sanity check of the inline script:

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

JS parses OK, file size: 7343 -rw-r--r--. 1 node node 7344 Aug 15 13:53 index.html

assistant
thinking
The JS syntax has been verified. Done. Note: `new Function` wraps it in a function, but since the IIFE uses "use strict" internally, it's fine. The references to `document` are only executed at runtime. Good.

Done. `index.html` is a single self-contained file (no external resources) with: - **Full-screen canvas** rendering the Mandelbrot set, HiDPI-aware (`devicePixelRatio` scaling) - **Smooth coloring**: continuous escape-time value (`n + 1 − log₂(log|z|)`) mapped through a log-scaled cosine palette for a smooth gradient; a large escape radius (2¹⁶) keeps coloring stable at deep zoom - **Click-and-drag to pan** (mouse + single-finger touch bonus) with grab/grabbing cursors - **Mouse-wheel to zoom** centered on the cursor (anchor-point zoom), using an exponential factor so both discrete wheels and trackpads feel smooth; zoom clamped to ~1e-13 to avoid floating-point artifacts - **Adaptive iteration count** (300 → 3000) that grows as you zoom in - **Chunked rendering** in ~24 row slices via `requestAnimationFrame` so the UI stays responsive, with a render-token guard that cancels stale frames - A small HUD showing the current center coordinates, zoom level, and control hints

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-27b
vendorQwen
harnesspi-agent
generated2026-08-15

EVALUATION

3/5 working

Mandelbrot rendered with pink/black gradient; drag pans and wheel zooms correctly, but colors lack smooth variety.

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 drag15.9%
on wheel8.0%
on enter + space0.0%
on arrow keys0.0%
on w/a/s/d0.0%
frame spread31.3 / 255
console errors0
js errors none

METRICS

runtime451.7s
tokens in34k
tokens out4.6k
cached0
cost / run$0.0302