Boids — flocking from three rules
Separation, alignment, cohesion. Out flies a flock.
In 1986 Craig Reynolds gave each simulated bird three local instincts: steer away from neighbours that are too close (separation), steer toward the average heading of nearby flockmates (alignment), and steer toward their average position (cohesion). No leader, no plan, no global view. From those three tiny urges emerge tight flocks, splitting streams, swirling reunions — the same choreography that real starlings, fish schools and locust swarms perform.