Boids flocking · claude-sonnet-5.5
Output generated Cost / run $0.0418 Runtime 24.8s
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.
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
METRICS
Transcript · 6 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.
/tmp/job-yqRd6m/index.html (3807 bytes){"action":"inspect"}Successfully wrote to /tmp/job-yqRd6m/index.html
Frame 1, +0ms
[Browser image supplied to model]
{"console":["warning: An iframe which has both allow-scripts and allow-same-origin for its sandbox attribute can escape its sandboxing."],"dom":"Move the mouse to scare the flock · click to add boids","images":"attached"}
I wrote `index.html` in `/tmp/job-yqRd6m`. I only checked that it loads and renders. I didn't test the mouse-flee or click-to-add behavior. I didn't check whether the flock forms groups over time either. The page loaded with no errors, apart from a sandbox warning that comes from the browser tool's iframe. The screenshot shows about 250 oriented triangles spread across the full screen, with motion trails and a hint line at the top left. - **Flocking:** each boid applies separation, alignment and cohesion to neighbors within 60 px, and separation applies within 24 px. - **Steering:** forces are capped, and each triangle's heading eases toward its direction of travel instead of snapping to it. - **Mouse:** boids within 140 px of the cursor flee and can briefly go about 1.7× faster. A faint red circle shows that radius. - **Edges:** boids are nudged back from the edges and wrap around if they cross one. - **Clicking:** adds 10 boids at the click point.