If you haven't seen the boids pseudocode page by Conrad Parker it's definitely worth checking out: <a href="http://www.vergenet.net/~conrad/boids/pseudocode.html" rel="nofollow">http://www.vergenet.net/~conrad/boids/pseudocode.html</a><p>Here's an implementation I wrote last month for fun: <a href="http://breefield.com/lab/flock" rel="nofollow">http://breefield.com/lab/flock</a>.
It doesn't have much bias in terms of direction (there's no wind, or patterns to follow), so there's generally one large swarm. Click-drag to create repellers, boids follow mouse.
The white center of each boid shrinks at it's velocity increases, and the inverse happens to it's red direction line. Purple specks indicate perceived center of nearby flock. The rest is just aesthetic.<p>It's always super interesting to see other implementations in action, so please share more in your comments, if you have them. I'd certainly love to see them.