Interactive simulation of Craig Reynolds boids. Base of this flocking algorithm are three rules: cohesion, alignment and separation.
Source code can be found here.
Point where you want selected entity to spawn and press 's'