As a part of my PhD defence in 2015 I gave a trial lecture on the topic Mathematical models for flocking and swarming. In preparation for this lecture I implemented a code simulating flocking behavior in a group of agents following the three rules of Reynolds.
The code I wrote, with documentation, can be found on its github page HERE. It is written in object-oriented python and released under the MIT license in case someone finds it useful.
For anyone interested in the phenomena of flocking the wikipedia page is a great place to start. Also, Craig Reynolds’ website on the subject contains a lot of resources.