Assignment 12

Due date: 4/18 @ 9:50 pm


For this final homework, you can show how much you have learned: design by composition of functions, design by structural recursion, design by generative recursion, organization via local, design of abstractions, use of abstractions, the addition of accumulators. The homework counts for 5% of the total course grade (aka the instructor's whim). As you work on the project, imagine that we hand over your software to the graders together with a modification of the project description and the task to change your software accordingly. Naturally they expect the software to be designed well, that is, based on what you learned in 211 and they know where you live (or at least your email).


Fighting UFOs:

Imagine you have become a game developer and your manager poses the problem of developing the first version of a War-of-the-Worlds game, freely named after H. G. Wells's science fiction novel. The purpose of the game is to prevent a UFO from landing on our world and from destroying the last available weapon. The screen shot on the right illustrates the successful defense of your world.

The UFO descends from the sky. As it does, it randomly drops little bombs. If those bombs, hit the last available weapon platform, dubbed AUP, the player loses. The player also loses if the UFO reaches the ground unharmed.

The player owns an anti-UFO platform (AUP), which can move left and right on the ground. It reacts to left and right keystrokes only. A first keystroke causes the AUP to move continuously. Additional keystrokes accelerate the AUP, if the player uses the arrow key of the direction in which the AUP is heading; otherwise the AUP decelerates. With the uparrow key (and/or the space bar), the player can also launch anti-UFO missiles from the AUP. These shots go straight up at a constant speed. If any of them hit the UFO, it destroys the UFO.

Hints: Develop the game in stages:

  1. Design the functions that move an AUP as directed by keystrokes.
  2. Modify these functions so that the player can shoot. The shots should ascend from the middle of the platform.
  3. Design the functions that simulate the UFO's descend to the ground.
  4. Modify these functions so that the UFO's path is a random walk (zig-zag); it should never leave the canvas, however, and should not make large leaps.
  5. Add functions that cause the UFO to release bombs at random points.
  6. Integrate all the functionality.
Keep the design recipe in mind as you develop all these functions. Not following it will certainly get you into trouble here.

Last modified: Fri Apr 6 16:42:34 EDT 2007