oneshotlm
Compare all models on this prompt →

Boids flocking · claude-opus-4.8

Output generated Cost / run $0.1611 Runtime 49.6s

Prompt for this run

Create a full-screen flocking simulation of boids using separation, alignment, and cohesion, drawn as oriented triangles that steer smoothly and flee from the mouse cursor.

⛨ 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

modelclaude-opus-4.8
vendorAnthropic · Claude
harnesspi-agent
generated2026-07-08

METRICS

runtime49.6s
tokens in21k
tokens out4.4k
cached13k
cost / run$0.1611
Transcript · 8 messages
user

Create a full-screen flocking simulation of boids using separation, alignment, and cohesion, drawn as oriented triangles that steer smoothly and flee from the mouse cursor.

assistant

I'll create a full-screen boids flocking simulation with all the classic behaviors plus mouse fleeing.

→ write /workspace/index.html (7255 bytes)
toolResult

Successfully wrote 7255 bytes to /workspace/index.html

assistant
thinking
I'm removing some redundant separation logic and cleaning up an unnecessary limit operation.

Let me clean up a couple of redundant lines I left in.

→ edit {"path":"/workspace/index.html","edits":[{"oldText":" sepX /= sepN; sepY /= sepN;\n setMag({x: sepX, y: sepY}, CFG.maxSpeed);\
toolResult

Successfully replaced 2 block(s) in /workspace/index.html.

assistant
→ bash {"command":"cd /workspace && node -e \"require('fs').readFileSync('index.html','utf8'); console.log('ok, bytes:', require('fs').statSync('in
toolResult

ok, bytes: 7170

assistant

Done. `index.html` is a self-contained full-screen boids flocking simulation. **Features implemented:** - **Separation** — boids steer away from close neighbors (inverse-distance weighted) - **Alignment** — match average heading of nearby flockmates - **Cohesion** — steer toward the local center of mass - **Smooth steering** — each rule produces a steering force capped by `maxForce`, so boids turn gradually rather than snapping - **Mouse flee** — boids within a radius accelerate away from the cursor, strength scaling with proximity - **Oriented triangles** — each boid is drawn as a glowing arrow-triangle rotated to face its velocity - **Motion trails** via semi-transparent frame clearing, edge wrapping, hue variation, and click-to-spawn more boids Open it in any browser — no network or external resources required.