CS 111: Introduction to Computer Science

Graphical prairie, with mountains and animated bison

Hand in via Moodle as prairie.py.

You will work with a partner assigned to you. Submit your code only once (i.e. to one partner's Moodle account, not to both), but make sure to include both partners' names in a comment at the top of your source code.

Goals

The project

In class on Wednesday 10/24, we began work on a program to draw and maintain a graphical city, with static buildings shown in the background, and cars moving in the foreground. We started by developing a Building class, and a main program to generate a background consisting of a bunch of buildings. Later, we added car.py for a Car class, and city.py to hold a main program that combines Car and Building objects into a single program.

For this assignment, your job will be to write a similar program. Your program, when complete, 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 bison moving in the foreground. The bison should move right to left. When a bison disappears off the left edge of the window, a new one should be generated entering at the right 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 Bison class in a separate file called bison.py. Your main program should be in a file called prairie.py, which will import both the mountain module and the bison module.

If both you and your partner complete the basic program and want to add more features, go right ahead. For example, you might add bison 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.

Start early, ask questions, and have fun!