Schools and Flocks

Some of the first simulations I ever ran in grad school were simple agent-based models that show how individual agents following rules based on their local environment could enable globally coordinated behaviors. 


As a first pass, let's simulate a crowd of swimming fish where each fish follows just a few simple rules. These are the basic rules underlying the Boid simulations


1 and 3 may seem contradictory, but we'll handle that here by having two distinct radii over which these rules operate


Let's start by creating a python class for a single fish. For each fish, we'll keep track of it's position, angle, and velocity. Since we may want to enable individuality later, let's put the individual's parameters here as well rather than having them be globally assigned in the simulation. 



Next, let's create a class for the simulation.