CS 1102 (A08) Homework 2: the FireFighter game

Due: September 11 (Thursday) at 11:59pm via turnin (assignment name hwk2).

Assignment Goals

The Assignment

Remember to follow the Expectations on Homework when preparing your solutions, including the academic honesty policy.

Your job is to write a simple interactive game in which the player drops water from a plane onto fires on the ground; the goal of the game is to put out all of the fires by dropping enough water on them. A sample appears to the right.

The plane flies continuously back and forth across the screen (ie, the user does not control whether the plane moves). The player can change the direction of the plane by pressing the left and right arrow keys. The player can also drop water from the plane by pressing the down arrow key. Each fire has an intensity: when a drop of water hits a fire, the intensity decreases. If a fire burns without water hitting it, its intensity increases. A fire is extinguished when its intensity reaches zero.

You will build this game using the same world.ss teachpack used in lab 1. If you need more documentation than was in lab 1, look up world.ss in the DrScheme helpdesk.

Work in the "Beginner with List Abbreviations" language level.

To write this game, you will need to provide at least the following:

Once you have these functions, you will run your game using the commands (as you did in lab):

(big-bang WIDTH HEIGHT (/ 1.0 28) INITWORLD)
(on-redraw draw-world)
(on-key-event process-keys)
(on-tick-event update-world)
where WIDTH, HEIGHT, and INITWORLD are constants you define for the size of the game window and the initial configuration of the game.

You must decide what other functions to implement as part of writing the required functions listed above. However, we expect you to follow the design-recipe strategy presented in class in which one function processes one data definition (as we saw in list of structs). You may bend this rule for posns located directly within other structures (ie, you don't need a separate function just to process the posn), but not otherwise. If you don't follow the design recipe, this assignment will take you FAR longer than necessary. You'll also lose substantial points.


If you and your partner prefer to work separately, work out and agree on the data definition first, then proceed to work on the rest of the code (together or independently).

Implement the game in stages, not all at once. Start with a simple version that lets the user change the direction of the plane's movement, but has no fires or water. Once you have that working, add the water drops and get them to fall. Once that is working, add the fires. Get the fires to decrease in intensity when water hits them, then get them to increase in intensity when no water falls on them. You will get more credit for a fully-working solution to part of the game than for a non-working solution to the whole game. You should have the game working at least through water drops falling for a passing grade on this assignment.

Hints and FAQs

Our Images

Use the "insert image" option under the "special" menu to load an image into your DrScheme file; you can use define to give an image a name. We used the circle operator (defined in world.ss) to get images for the water drops.

small fire medium fire large fire plane

Icons are from school-clip-art.com (fire) and clipartguide.com (plane).

What to Turn In

Turn in a single file hwk2.ss or hwk2.scm containing all code and documentation for this assignment. Make sure that both students' names are in a comment at the top of the file.

Back to the Assignments page