2010 March 1 / j d a v i s @ c a r l e t o n . e d u


In this laboratory exercise we continue our study of object-oriented programming. We build on the Particles exercise to perform simulations in which the particles respond to their environment. As was the case with Particles, you must run the code on one of the lab machines. Download these files to your computer.

Execute particle.py and read through the code. The code reflects all of the changes described at the end of Particles. I have also added a getGraphics() method.

Execute gravity.py and read through the code. This is our first example of subclassing. We'll discuss it together.

Execute zombie.py and read through the code. The Person and Zombie classes have a lot of redundant code. How could we improve the structure of the program, to remove this redundancy?