CS 111: Introduction to Computer Science

Graphical Praire, with Mountains

Due: 11:59PM Friday, October 30. Hand in as prairie.py, plus additional modules as needed.

In class on Friday 10/23, we will begin work on a program that will draw and maintain a graphical city, with static buildings shown in the background, and cars moving left to right in the foreground. We'll start by developing a Building class, and a main program to generate a background consisting of a bunch of buildings. We will continue the discussion, if necessary, on Monday, 10/26.

For this assignment, your job will be to write a similar program. Your final program, when runnning, should display a randomly generated collection of mountains (how many mountains is up to you and your aesthetic sense), with a randomly generated collection of moving buffalo in the foreground. The buffalo should move left to right. When a buffalo disappears off the right edge of the window, a new one 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 Mountain class in a file called mountain.py. Put your Buffalo class in a separate file called buffalo.py. Your main program should be in a file called prairie.py, which will import both the mountain module and the buffalo module.

If you find this program straight-forward, feel free to add extra features. For example, you might have buffalo moving in both directions, or airplanes, or trees, or mountains with fancy jagged snow lines, etc. These extra goodies, however, should be pursued only for your own pleasure; a straight implementation of the prairie as described in the previous paragraphs will be eligible for full credit.