Computer Science I for majors by James Tam |
(Although functions are not a new concept to be applied for this assignment your program must be decomposed into functions using "good style" Slide No. 80 - 82 ('decomposition' notes) and documented as specified on Slide #76. Otherwise you will be penalized heavily for functionality and documentation.
Character |
Value represented |
|
H |
Homer Simpson (controlled by the player) |
|
# |
A building (cannot be entered) |
|
E |
Agents of the EPA (controlled by the computer) |
|
~ |
Water (Homer can enter, EPA agents cannot) |
|
S |
The town of Springfield (Homer can enter, EPA agents cannot) |
|
The space represent empty parts of the game world. |
In the assignment4 directory there is a [partial source code] program that provides the starting positions for all the characters in the list. Although it is not mandatory that you use this start code, to get full credit your program must be able read in, at a minimum, all the starting positions in all the [data files] provided. (Other data files may be used by the marker with different positions but they will all consist of 20x30 game world with the above set of characters).
The goal of the game is to bring Homer from Alaska (top portion of the grid) back to the town of Springfield (near the bottom right). However if Homer takes too long to travel out of Alaska he will freeze and the player loses the game. Also if Homer moves into the water he drowns and the game is lost. Finally the tireless agents of the EPA will try to capture Homer and if that occurs the game is lost. The game will be run on a turn-by-turn basis. A turn elapses when: Homer moves or the player tries to move him (Homer ignores the command or the player tries to move Homer onto a building), Homer stays on the same square (direction 5), or the player toggles the debugging mode on or off. A turn won't pass if the player enters an erroneous value for the movement direction (10 or larger). After Homer moves the EPA agents will move in the fashion described in Point #15 below. The game continues until: 1) The player has lost the game (Homer drowns, freezes or is captured...Doh!) 2) The player has won the game...Woohoo! 3) The player has quit the game. *Shrugs*
Features to be implemented (you will also be graded on other criteria such as coding style and providing program documentation as listed in the marking key): |
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Required output of the debugging messages: Format:
<<< A list that shows for each possible randomly generated number (or range of numbers) how the program will react. <<< The way that the program actually reacted for the random number generated >>> Example program output:
<<< Number = 1 - 25, Homer is distracted >>> <<< Number = 26 to 100, Homer follows the player's movement instructions >>> <<< Homer becomes distracted and refuses to move >>> |
||
|
||
|
||
|
||
|
||
Required output of the debugging messages: similar to Feature #12 in order to get credit for this feature your program must display specific output messages that clearly indicate to the marker that your program is working. General format: Example program output: |
||
|
||
Prior to player's move: Homer and agent are in close proximity | ||
Player tries to move Homer but the command is ignored. The agent moves adjacent to Homer and captures him: the game immediately ends and a suitable consolation message is displayed. | ||
1 This from the view of a student who is new to programming the design and problem solving issues faced in this assignment are non-trivial. It's worth noting that compared to an actual commercial system that this software is still quite small. |