CS 111: Introduction to Computer Science

Graphical Ocean

Due: 9:50AM Wednesday, February 17. Submit a folder called "ocean" containing ocean.py, fish.py, and bubble.py, plus any additional modules you add if you feel like it.

In class on Wednesday 2/10, we worked on a class called Car. Each object of type Car represents a primitive graphical automobile, with a few simple attributes (color, speed, size, and location) and manipulable via a small number of methods (draw, undraw, move, and step). I finished work on Car after class. You can experiment with the results by grabbing car.py and cartester.py, placing them in a folder with graphics.py, and running "python cartester.py".

For this assignment, your job will be to write a program showing an animation of a simple underwater scene. Your final program, when runnning, should display a randomly generated collection of fish and bubbles against a suitably watery background (just blue, for example, is suitably watery). As the animation proceeds, the fish should swim back and forth (switching directions when they hit the sides of the window) and the bubbles should rise. When a bubble hits the top of the screen, it should disappear and be replaced by a new randomly generated bubble at the bottom of the screen.

Put your Fish class in a file called fish.py. Put your Bubble class in a separate file called bubble.py. Your main program should be in a file called ocean.py, which will import both the fish module and the bubble module.

If you find this program straight-forward, feel free to add extra features--waving plants, vicious sharks, submarines, or whatever strikes your fancy. These extra goodies, however, should be pursued only for your own pleasure; a straight implementation of the ocean as described in the previous paragraphs will be eligible for full credit.

Suggestions

Have fun.