Homework 9
Due: Thursday, Apr. 21 at 11:59pm on Moodle
For this assignment, you are welcome to discuss your work with other students, but all code you submit should be your own original work. It should be produced and understood by you, without looking at anyone else's assignment.
Credit for this assignment: Joe O'Rourke
Please take the short Week 9 quiz on Moodle (also due by Tuesday night). This is to help me understand what areas need work, and also help you understand what concepts might need extra practice. It is not a large part of the overall homework grade. Just for the quiz part, do not discuss the questions with other students, TAs, etc. (Note: quiz usually posted Wednesday afternoon.)
There are not specific steps, but the required functionality is described below.
Your program should contain a Fish class with the following:
Each fish should have at least three components: body, eye, and tail. Not all the fish should be moving at the same speed, and the fish should be different colors.
Each fish should swim in a "circle" around the tank, wrapping around one side and emerging on the other. This wrapping functionality should be done within the Fish class, not main. You could either put this functionality in the move(..) method, or in a separate wrap(..) method that is called along with move(..). Either way, one of your methods should take in the width of the window as an argument, so it can check whether or not the fish needs to be wrapped around.
The fish should move horizontally, but should also bob up and down while moving as shown in the video (this is a minor detail which will not be worth very much, so I might leave it for last).
In the main function, you should create a list of Fish. Then using a while loop, continue to loop over the fish indefinitely, moving the fish one by one (see Day 30 notes for more details). If the user clicks the window, the animation should stop.
Lastly, create a Bubble class that will send bubbles floating upwards (they can also wrap on the bottom of the window). If you would like to replace this with another class in the spirit of the assignment (swaying kelp, another type of fish, etc), that's fine as long as it moves in some systematic way.
You do not have to submit a transcript for this homework. Instead, take a representative screenshot of your animation and submit that with your code. Make sure that you've thought about variable names and code structure, and that your code is well-commented. For each method and helper function, create a docstring describing the functionality and input/output.
TO SUBMIT ON MOODLE: