Boids is a computer simulation, written by Craig Reynolds, for modeling the flocking (see Swarm Behavior) of birds, to produce emergent behavior using simple rules to describe how individual birds in the simulation move, based on the positions and velocities of nearby flockmates. The 3 rules can be explained as:

separation: steer to avoid crowding local flockmates alignment: steer towards the average heading of local flockmates cohesion: steer to move toward the average position of local flockmates

Additional rules can be added in to further model other emergent behavior and scenarios.

Further information on Boids can be found here: Craig Reynolds website - also contains links to a number of resources on computational models of group motion as well as other emergent systems, especially biological ones, and links to different modelling codes. (be forewarned that many of the links are dead or outdated)

For the programming-minded, Conrad Parker explains the programming behind Boids in pseudo-code: Boids Pseudocode

An interactive and graphically improved Boids variation:

Some related interactive applets: Floys -similar to Boids, but includes rules to be territorial against other species. More complex variations include potential for individualism (iFloys) and the ability to evolve (eFloys) as well as a much more highly customizable version (GOOeFloys)