Due Wednesday, 2012-04-18, 11:59pm
In this homework, you will practice GUI programming, using Tkinter.
You will first need to download hw3_320.py.
You will edit this file and submit the result; call it
Remember to include your name and the assignment number in a comment at the top of the file
and to use lots of comments in your code, including docstrings for all functions that you define.
The world this time consists of a torus, a doughnut-shaped object that wraps around to the left and right and from top to bottom. That is, there aren't any walls that stop things from moving in whatever direction they're heading. The only kinds of things in the world are diskoids, which are round, yellow creatures that can turn and move. They get hungry with time and search for food, the distance traveled depending on their hunger. The only food is available in the "fertile square" located in the dark green region between coordinates (0,0) and (100,100) in the world. When they reach this region, their hunger decreases, so they tend to stay there for some time.
There are three classes in the program:
WorldFrame, a subclass of the Tkinter
World, a subclass of the Tkinter
Canvas class and also the class that keeps track of things in the world; and
Diskoid, the class that defines the diskoid objects.
In its initial form, the program just creates a frame and a canvas inside it. There are no diskoids in the world. You will need to add three buttons and make them have particular effects and to make the canvas respond to mouse clicks with modifier keys.
killmethod is called).
step, causing each of the diskoids to execute its
stepto be called 100 times.
clear, removing all of the diskoids from the world.