Boids flocking · qwen3-coder
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 · 4 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 flocking simulation of boids with all the requested features. Here's the complete solution in a single HTML file:
index.html (14267 bytes)Successfully wrote 14267 bytes to index.html
I've created a complete boid flocking simulation with all the requested features: 1. Full-screen canvas that resizes with the window 2. Boids drawn as oriented triangles that smoothly steer 3. Implementation of the three core flocking behaviors: - Separation: boids avoid crowding each other - Alignment: boids steer toward the average heading of neighbors - Cohesion: boids move toward the average position of neighbors 4. Mouse cursor repulsion: boids flee from the mouse when it's nearby 5. Smooth steering with acceleration and velocity 6. Boundary wrapping so boids reappear on opposite edges 7. Colorful boids with individual hues 8. Visual trails for a smoother appearance The simulation uses efficient algorithms to calculate flocking behaviors while maintaining good performance. The boids are drawn as oriented triangles that point in their direction of travel, and they react smoothly to both flocking forces and mouse movement. To use the simulation, simply move your mouse cursor around the screen - the boids will flee from it while maintaining their flocking behavior. The simulation runs at full screen and will automatically adjust 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
EVALUATION
Colorful triangular boids flock and leave trails, reacting to mouse position with cohesive movement patterns.
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.