The Boid model is a famous multi-agent model that was invented by Craig Reynolds. Each Boid is an agent following three simple rules: (1) Align with other neighbors; (2) Try to be close to neighbors; (3) Avoid collision with other neighbors. These rules can make the flock of Boids reproduce the behaviors of real bird flocks or fish schools. Push the Play button to trigger the simulation, and adjust the number of Boids, the size of the world and other parameters by using the sliders, then enjoy yourself.
Normally, animations in Mathematica made by animation functions are played with a list of histories. This method has lots of weak points, such as fixed history size and massive computation before performing. Actually, this Demonstration shows that manipulation and animation functions can be also used as triggers to invoke simulation steps. This makes it possible to realize real-time simulations in Mathematica.