oneshotlm
Compare all models on this prompt →

Boids flocking · qwen3.7-plus

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 ↗
transcript · 4 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
thinking
The user wants a full-screen boids flocking simulation with:
1. Separation, alignment, and cohesion behaviors
2. Oriented triangles (showing direction)
3. Smooth steering
4. Flee from mouse cursor
5. All in one self-contained index.html file
6. No external dependencies

Let me build this with a canvas-based simulation. I'll need:
- A boid class with position, velocity, acceleration
- The three flocking rules (separation, alignment, cohesion)
- Mouse avoidance
- Smooth steering (limiting forces)
- Oriented triangle rendering
- Full-screen canvas with animation loop

Let me write a comprehensive implementation.
write /workspace/index.html (9909 bytes)
toolResult

Successfully wrote 9909 bytes to /workspace/index.html

assistant
thinking
The file has been created successfully. Let me summarize what I built.

Done. Here's what's in `index.html`: **Simulation features:** - **300 boids** rendered as oriented triangles that rotate to face their velocity direction - **Three classic flocking rules** — separation (avoid crowding), alignment (steer toward average heading), cohesion (steer toward center of mass) - **Spatial hash grid** for O(n) neighbor lookups instead of O(n²) - **Mouse flee behavior** — boids are repelled by the cursor with a force that scales by proximity, shown with a subtle red radial indicator - **Soft edge avoidance** — boids steer away from screen edges with a smooth falloff zone - **Smooth steering** — all forces are accumulated as acceleration and clamped against `MAX_FORCE` / `MAX_SPEED` for natural movement - **Visual polish** — HSL coloring shifts with speed and position, subtle glow edges, trail effect via semi-transparent background fade, chevron-shaped triangles (not just equilateral — they have a tail notch for better direction readability) - **Touch support** for mobile devices Everything runs fully self-contained with zero network requests.

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.7-plus
vendorQwen
harnesspi-agent
generated2026-07-22

EVALUATION

4/5 working

Boids flock smoothly as oriented triangles, react to mouse with a visible red repulsion field, and animate continuously.

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 motion23.0%
on click24.8%
on drag28.0%
on wheel27.2%
on enter + space21.6%
on arrow keys20.5%
on w/a/s/d20.1%
frame spread22.8 / 255
console errors0
js errors none

METRICS

runtime71.1s
tokens in6.7k
tokens out3.7k
cached0
cost / run$0.0070