CSCI 110 - Programming Assignment 3 - Due: Friday, March 7, 3pm

Program Description

This program will give you practice using conditionals, a single while loop, and functions. As always, proper documentation, appropriate use of constants and identifiers and good programming style is expected.

Imagine that you suddenly find yourself in a dark room. The room is sealed and has only 120 minutes of air. There is an exit but there are also hazards: a waterhole which, if you fall in, causes you to use up an extra 10 minutes of air, walls which you may not walk through and a bottomless pit from which you cannot escape. There is also a an air tank hidden, which holds an additional 20 minutes of air. You will search for the exit using the arrow keys, each key stroke uses a minute of time. I have provided a program which moves a player and generates all special positions: p3.cpp.

To make this game somewhat interesting to the player, the initial position of the player and all special locations will be randomly generated using rand( ) and should not be printed until the end of the game. For testing purposes, however, I strongly suggest that you assign values to these locations rather than calling the function I have given you to generate random locations.

Input

The only input to this program is the player entering moves via the arrow keys or the letter 'q' to signify that the player wishes to quit. The code necessary to read input has been provided in the partial program I have provided for you.

Manipulations

You must make appropriate use of functions when testing for the special locations. In addition: After you have thoroughly tested your program with assigned values for initial and special positions, be sure to call my function GenerateAll to randomly specify the locations.

Submitting your Program

After thoroughly testing your program, place a copy of your source code on the G: drive no later than Friday, March 7, 3pm. You must also give me a copy of the source code bearing your honor code signature by that time.