Posts

Showing posts from February, 2019

Simulating Bird/Fish Flocking (Python)

For my second (and hopefully last) project in Python, we had to simulate flocking behavior , as outlined in Craig Reynolds' post . More Python Challenges Since I don't have much experience with Python, again the majority of this project was learning the language. I used a very helpful graphics library for python called pygame , which has a lot of capability for such a simple library. Also, I discovered that Python is a lot more annoying when it comes to having multiple files and importing the classes in such files into the main class. With some help from my classmates, I learned that Python has support from <File> import <Class> which removed the need to call <File>.<Class>   every time I needed to access an imported class. Flocking Behavior The behavior itself is relatively simple. As Craig outlines in his post listed above, the main behaviors of flocking consist of cohesion, separation, and alignment . Cohesion is the behavior that brings boi