Boids flocking · claude-opus-4.8
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.
transcript · 8 messages
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.
I'll create a full-screen boids flocking simulation with all the classic behaviors plus mouse fleeing.
/workspace/index.html (7255 bytes)Successfully wrote 7255 bytes to /workspace/index.html
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.
{"path":"/workspace/index.html","edits":[{"oldText":" sepX /= sepN; sepY /= sepN;\n setMag({x: sepX, y: sepY}, CFG.maxSpeed);\Successfully replaced 2 block(s) in /workspace/index.html.
{"command":"cd /workspace && node -e \"require('fs').readFileSync('index.html','utf8'); console.log('ok, bytes:', require('fs').statSync('inok, bytes: 7170
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.
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
EVALUATION
Boids with trails flock and cluster continuously, colored triangles with alignment/cohesion visible, but flee-from-cursor effect isn't clearly shown.
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.