Based on Dancing with friends and enemies, by Simon Woods (eight lines of mathematica). At each step, each boid moves towards its friend and away from its enemy and toward the center of mass of all the boids, by amounts determined by the sliders above. The fickleness parameter controls the probability that a fraction of the boids each choose a new friend and enemy at each time step; turning it up causes gravitational collapse.
The system can spontaneously break parity symmetry by producing a chiral edge current of boids!
Nice review on active matter. Craig Reynolds' original Boids. Talk about Julia implementation by Jesse Bettencourt.