CS 111: Introduction to Computer Science

A Graphical City

In class on Friday 5/1, we began work on a program that would draw and maintain a graphical city, with static buildings shown in the background, and cars moving left to right in the foreground. We worked on the Building class, and will revisit it on 5/6.

For this assignment, your job is to complete this program. Your final program, when runnning, should display a randomly generated collection of buildings (how many buildings is up to you and your aesthetic sense), with a randomly generated collection of cars in the foreground. The cars should move left to right. When a car disappears off the right edge of the window, a new car should be generated entering at the left edge of the window. Your program should run indefinitely, until you cancel it (e.g. via a Ctrl-C in its terminal window).

Put your Building class in a file called building.py. Put your Car class in a separate file called car.py. Your main program should be in a file called city.py, which will import both the building module and the car module.

If you find this program straight-forward, feel free to add extra features. For example, you might have cars moving in both directions, or airplanes, or trees, or buildings with antennas on top, or buildings shaped like the Sydney Opera House or the Weisman Art Musem. These extra goodies, however, should be pursued only for your own pleasure; a straight implementation of the city as described in the previous paragraphs will be eligible for full credit.