Flocking Simulation

Spacebar toggles flocking on/off.
R resets the demo.
D toggled the debug lines.

This a simulation of flocking behaviour based on the Boids simulation created by Craig Reynolds. Flocking adheres to three simple rules:

The pink lines connecting the birds (or 'boids') in the demo represent neighbour association, i.e. being within a certain radius of each other, and therefore 'flocking'.
The applications of flocking behaviour range from the obvious use of simulating animals, to data visualisation, to homing missiles!