a gaggle of mfas, by Dan Waber
Click the mouse to add a new graduate/boid anywhere on the canvas.
When reading about emergent behaviors and the Boids program written by Craig Reynolds, I was struck by the (only!) three rules needed to define flocking behavior. They are:
Separation--steer to avoid crowding local flockmates.
Alignment--steer toward the average heading of local flockmates.
Cohesion--steer to move toward the average position of local flockmates.
My grandfather loved to say, "I know what a hammer is for, but what's a metaphor?" Well, this one just thocked me right on the forehead.
I didn't code this up from scratch, it's a cheeky tweaking of "Flocking" by Daniel Shiffman, which is itself an implementation of Craig Reynold's "Boids "program to simulate the flocking behavior of birds.
Each graduate/boid steers itself based on rules of avoidance, alignment, and coherence.
Source code: agaggleofmfas