Automatic Landscape

This assignment is to be done individually without your teammate. You can talk to other people in the class (including your teammate), me (Dave), the prefect, and lab assistants for ideas and to gain assistance. You can help each other debug programs, if you wish. The code that you write should be your own, however, and you shouldn't hand a printout of your program to others. See the course syllabus for more details or just ask me if I can clarify.

Part 0: Overview

Many aspects of backgrounds and landscapes that you see in today's movies are computer enhanced. Perhaps the weather was wrong on the day the film was shot, or maybe the director had a change of mind involving the mood. For this assignment, you will create an image that can be changed and adjusted by the user.

Part 1: Draw a landscape and cloud

Create a directory named landscape1 to store your work, then copy into it the graphics.py library that we used in the previous lab. Write Python code to make a canvas of size 500 pixels wide and 700 pixels high, then draw a simple landscape. Your landscape doesn't have to be particularly fancy, especially if your artistic skills are as bad as mine. Set the background to blue to represent a sky, then draw a couple of rough hills or buildings using ovals or rectangles.

Draw a small white cloud at the top left corner off your canvas. Your cloud can be as simple as a cloud-sized oval, but feel free to use multiple overlapping ovals or other techniques to make your cloud as attractive as you like.

Part 2: Make the position of your cloud adjustable

The goal of this part of the assignment is to place the cloud in different places in the sky, depending on where the user of your program wants it. Specifically, your program should ask your user for a wind speed (in miles per hour), and the number of hours that have passed since the cloud first appeared in the top left of the window. Your program should then draw the cloud in its correct location. Assume that the image is 20 miles across, and that the wind is blowing directly to the right. Here is a sample of what the interaction between your program and your user should look like. The user's responses are in red so that you can tell what the user has typed. (In reality, though, this should appear in the same color as all the other text in your terminal window).


Automatic Landscape Builder

What is the windspeed in miles per hour? 3.5
How many hours have passed? 2.5

Here is your picture!

You will need to do some arithmetic to determine precisely where the cloud should go:

Here are some things you can do to test your code:

Finally, begin thinking about good style for your programs. You should make them as readable as possible for someone else trying to understand them. At a minimum, you should use comments at the top of your program indicating your name(s), and use comments above consecutive portions of Python code explaining what they do.

When finished, zip up your code like you did in the lab and submit your work through Moodle.

Good luck, and have fun! Remember that lab assistants are available in the evenings in CMC 306 to help out if you need it, and you can attend prefect sessions as well.