Due: Wednesday, April 1, 2009 at 5:00 pm.
This is the first part of a two-part assignment. The goal of this first part is to help you learn to work with imperative objects and the publish/subscribe pattern, and to give you some experience with iterative refinement of a problem.
As always, you must follow the design recipe. The deliverables for the design recipe are as in the preceding problem set.
These are based on the examples we did in class.
A car is a rectangle 10 pixels high and 20 pixels long. It travels at 20 pixels per tick on the first half of the street, and 4 pixels per tick for the second half of the street.
The street is 1000 pixels long, and the cars travel along the bottom of the canvas.
Develop this simulation using the draw package. Run your simulation with at least 3 cars on the street at one time.
We don't want the cars to collide, so a car may not get closer than 5 pixels to the rear bumper of the car ahead of it.
Modify your solution to the previous problem (using idraw). Observe traffic jams develop as R gets sufficiently small.
Last modified: Tue Mar 24 15:08:22 2009