Ball Simulation

The final project of Ics 33, is to create a simple simulation of various types of balls, in Python. In this project, the view and controller come already written, and I had to implement the model, or the underlying logic, and interface it with the controller. The main concept being taught by this is inheritance; each type of ball is a class, and each class inherits from another base class.

The blue Balls are simplest, they simply move at constant speed and bounce off of the edge of the canvas. Red Floaters are similar, but they randomly change direction and speed as they move. Black Holes are stationary, and ‘eat’ any ‘prey’ (Balls and Floaters) that hit them. Pulsators inherit from Black Holes, and grow or shrink depending on how much prey they eat. Hunters inherit from Pulsators, but are mobile, and will chase the nearest prey. And finally, the green Specials; each student could implement their Special however they wanted. I chose to make a kind of ‘snake’ out of multiple specials; it inherits from Floater (so it counts as prey), and the front ball behaves in the same way, but all the other balls will follow each other in a line.