oneshotlm
Compare all models on this prompt →

Double pendulum · qwen3.8-max

Simulate a chaotic double pendulum on a canvas using the correct equations of motion, drawing the arms and a colorful fading trail of the tip.

⛨ sandboxed Open in new tab ↗
transcript · 10 messages
user

Simulate a chaotic double pendulum on a canvas using the correct equations of motion, drawing the arms and a colorful fading trail of the tip.

assistant
thinking
Create a single index.html, implement RK4 integration of the double pendulum equations, canvas, and a fading trail (drawn on an offscreen canvas or using alpha fade). Give it a polished finish.
write /tmp/ws/index.html (11198 bytes)
toolResult

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

assistant
thinking
One small issue: there's leftover unnecessary code in resize(): `const old = tctx.getImageData && trailCanvas.width > 0 ? null : null;` — let's clean this up.
edit {"path":"/tmp/ws/index.html","edits":[{"oldText":" const old = tctx.getImageData && trailCanvas.width > 0 ? null : null;\n trailCanvas
toolResult

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

assistant
thinking
Optionally do a quick sanity check that there are no syntax errors in the JS — could run node with a stub, but there are DOM references. Easier approach: just extract the script and use node's `--check`. Let's give it a quick try.
bash {"command":"cd /tmp/ws && python3 -c \"\nimport re\nhtml = open('index.html').read()\nm = re.search(r'<script>(.*?)</script>', html, re.S)\n
toolResult

/bin/bash: line 1: python3: command not found Command exited with code 127

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

JS syntax OK

assistant
thinking
(Thinking) Done. The JS is syntactically valid.

Done — `/tmp/ws/index.html` is a fully self-contained double pendulum simulation (no external resources, JS syntax verified). **Physics** — exact Lagrangian equations of motion for the double pendulum: $$\ddot\theta_1 = \frac{-g(2m_1+m_2)\sin\theta_1 - m_2 g\sin(\theta_1-2\theta_2) - 2\sin(\theta_1-\theta_2)m_2(\dot\theta_2^2 L_2 + \dot\theta_1^2 L_1\cos(\theta_1-\theta_2))}{L_1(2m_1+m_2-m_2\cos 2(\theta_1-\theta_2))}$$ $$\ddot\theta_2 = \frac{2\sin(\theta_1-\theta_2)\big(\dot\theta_1^2 L_1(m_1+m_2) + g(m_1+m_2)\cos\theta_1 + \dot\theta_2^2 L_2 m_2\cos(\theta_1-\theta_2)\big)}{L_2(2m_1+m_2-m_2\cos 2(\theta_1-\theta_2))}$$ integrated with **classical RK4** at fixed ~2 ms substeps for stability. **Features:** - **Fading rainbow trail** of the second bob's tip, drawn on a separate offscreen canvas (via `destination-out` fade + additive `lighter` glow) so the arms stay crisp on top - **Arms & bobs** with radial-gradient shading, bob size scales with mass - **Controls:** sliders for m₁, m₂, L₁, L₂, gravity, trail fade rate, and simulation speed - **Interactions:** drag either bob to reposition, `Space` to pause, **Reset** (randomized angles), **Nudge** (random kick to see sensitivity), `R` key for reset - Hi-DPI aware and responsive to window resizing

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

4/5 working

Double pendulum simulation with trailing paths, animates continuously and responds to click, drag, and wheel; arrows/WASD have no distinct 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 motion1.8%
on click2.9%
on drag3.2%
on wheel2.9%
on enter + space1.2%
on arrow keys0.0%
on w/a/s/d0.0%
frame spread11.3 / 255
console errors0
js errors none

METRICS

runtime93.4s
tokens in27k
tokens out5.2k
cached19k
cost / run$0.0516