Boids flocking · llama-3.1-70b-instruct
Output generated Cost / run $0.0041 Runtime 37.4s
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 · 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.
[{"path":"/tmp/ws/index.html","content":"<!DOCTYPE html><html><head><style>body{margin:0;overflow:hidden;background-color:#333}canvas{displaValidation failed for tool "write": - root: must be object Received arguments: [ { "path": "/tmp/ws/index.html", "content": "<!DOCTYPE html><html><head><style>body{margin:0;overflow:hidden;background-color:#333}canvas{display:block}</style></head><body><canvas id=\"canvas\"></canvas><script>const canvas = document.getElementById(\"canvas", "x": "canvas.width / 2", "y": "canvas.height / 2", "velocityX": "Math.random() * 2 - 1", "velocityY": "Math.random() * 2 - 1]));function draw(){ctx.clearRect(0" }, { "x": "e.clientX,y: e.clientY};for (const boid of boids) {const distanceToMouse = Math.hypot(mouse.x - boid.x, mouse.y - boid.y);const angleToMouse = Math.atan2(mouse.y - boid.y, mouse.x - boid.x);const separationForce = 100 / (distanceToMouse + 10);boid.velocityX += separationForce * Math.cos(angleToMouse);boid.velocityY += separationForce * Math.sin(angleToMouse);}});</script></body></html>" } ]
It seems like I made an error. Let me try again. Here is the complete index.html file: ```
/tmp/ws/index.html (1520 bytes)Successfully wrote 1520 bytes to /tmp/ws/index.html
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 has been created. The simulation is contained within a single self-contained file named index.html in the current directory.