oneshotlm
← Back to comparison

Boids flocking · minimax-m2.7

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
transcript · 14 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 flocking simulation (boids algorithm) with:
1. Separation - steer to avoid crowding local flockmates
2. Alignment - steer towards the average heading of local flockmates
3. Cohesion - steer towards the average position of local flockmates
4. Oriented triangles as boids
5. Smooth steering
6. Mouse flee behavior

Let me create a spec first, then implement it as a single self-contained HTML file.
write /workspace/SPEC.md (2253 bytes)
toolResult

Successfully wrote 2253 bytes to /workspace/SPEC.md

assistant
thinking
Now let me implement the full simulation as a single index.html file.
write /workspace/index.html (7404 bytes)
toolResult

Successfully wrote 7404 bytes to /workspace/index.html

assistant
thinking
Now let me verify the file exists and review it for any issues.
bash {"command":"ls -lh /workspace/index.html && node -e \"\nconst fs = require('fs');\nconst html = fs.readFileSync('/workspace/index.html', 'ut
toolResult

/bin/bash: -c: line 22: unexpected EOF while looking for matching `'' Command exited with code 2

assistant
thinking
There's an issue with the shell quoting. Let me simplify the command.
bash {"command":"ls -lh /workspace/index.html"}
toolResult

-rw-r--r-- 1 node node 7.3K Jul 7 00:12 /workspace/index.html

assistant
thinking
The file exists and is 7.3KB. Let me verify the key parts of the file using grep instead.
bash {"command":"grep -c \"canvas\\|requestAnimationFrame\\|SEP_RADIUS\\|ALI_RADIUS\\|COH_RADIUS\\|mousemove\\|touchmove\" /workspace/index.html"
toolResult

15

assistant
thinking
All key components are present. Let me also verify there's no external CDN links.
bash {"command":"grep -E \"https?://\" /workspace/index.html || echo \"No external URLs found\""}
toolResult

No external URLs found

assistant
thinking
The file is complete, self-contained, with no external resources. All boid algorithm components are present:
- Separation, alignment, cohesion
- Mouse flee behavior
- Oriented triangles
- Trail effect
- Edge wrapping

Let me verify the final file to make sure it's syntactically correct by checking the structure.

`index.html` is ready — self-contained (7.3 KB), no external dependencies, with: - **200 boids** as oriented triangles that rotate along their velocity - **Reynolds flocking rules**: separation (2.5×), alignment (1.0×), cohesion (0.9×) with tunable radii - **Mouse flee**: boids within 130px steer away smoothly (weight 5.0×) - **Smooth steering**: forces are lerped frame-to-frame for organic feel - **Trails**: 5-frame fading afterimages per boid - **Colour**: HSL teal→violet gradient keyed to each boid's position - **Edge wrap**: boids teleport through screen edges - **Vignette background**: subtle radial dark gradient - **Touch support** for mobile

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

modelminimax-m2.7
vendorMiniMax
harnesspi-agent
generated2026-07-07

METRICS

latency109.5s
tokens in359
tokens out3.9k
cached29k
cost / run$0.0039