← All Labs

Boids Flocking Simulation

Three rules — separation, alignment, cohesion — produce lifelike flocking from local interactions

Craig Reynolds Boids (1987): each agent follows three local rules — avoid crowding neighbors (separation), steer toward average heading of neighbors (alignment), steer toward average position of neighbors (cohesion). Click the canvas to add a predator (red) that boids flee from. Emergent flocking arises from purely local interactions — no global coordination.