Flock is an algorithm I initially wrote about a year ago. In the past week, I've cleaned it up, optimized it (to support 1000 boids instead of 200), and added comments to make it readable.
It works best with P2D/OPENGL as a renderer, but that seems to break on most websites