(0) Prologue:
Mystery and mayhem in the Manor at 1 Drury Lane! Theres murder in the air and clues are everywhere. Inspector Gompei is stumped and has asked you for pointers on the case. Your task (and you will accept it) is to search the mansion room by room accumulating evidence. Youll need all the I/O skillz and Linked List facilities at your disposal to crack the case. (1) Construct the Mansion.
Inspector Gompei has sent you the files youll need to understand the floorplan and the nature of all the rooms in the Manor at 1 Drury Lane. The MansionRooms.txt file will hold the keys to the rooms. Each has its number, name, and number of bits of evidence (clues) recorded in the file. You will find it handy, as per our Room struct, to include fields indicating whether you have discovered the room and whether you have searched the room, but you will need to add these yourself. Since you have not yet arrived on the scene, these values are assumed to be their defaults and are not included in the file. The first line of the file is an int sentinel representing the number of rooms in the mansion (and therefore in the file).
The file MysteryMansionCS2303HW3.xlsx contains the floorplan of the mansion under tab Clue Board for HW3[1] and an adjacency matrix for its underlying graph under tab HW3Graph. You should fprintf that to a file as formatted data (dont forget your sentinel!) so that you can fscanf it in when you execute your program.
You may assume that the files contain valid information and that they are consistent. Furthermore, you can assume the floorplan is symmetricno trapdoors or one-way passages[2].
1
- Make Introductions
When you arrive on the scene, you will be met by Inspector Gompei. He will ask you whether you want to do a through examination of the entire mansion, or whether you would prefer just to localize your search to a set number of rooms or until you have found a certain number of clues. Inspector Gompei will also assist you by taking you directly to the room in which you would like to begin your investigation.
- Conduct Your Investigation
As you search a room, be sure to record the clues you find. You should also remember that you have searched the roomtimes a-wastin and the games afoot! Before you leave a room, check to see what rooms are adjacent to the one you are in and add them to your list of rooms to search (perhaps only if they have not already been searched).
- File Your Report
When you have concluded your inquiry, you must file your report. Be sure to enumerate the rooms you examinedin the order you examined them. Your report should include the number of clues discovered in each room you searched as well as the subtotal of clues to that point. You should file your report in duplicate, both to the screen and to a file.
- Evaluation
Your supervisor will evaluate your report based on the following criteria:
Mansion Construction | File I/O and Room Initialization | 20% |
Introductions | Keyboard Input and Control Flow | 20% |
Investigation | Graph Traversal (Breadth-First Search) | 20% |
Report | printf and fprintf | 20% |
Testing | Test-Driven Development Deployed | 20% |
[1] For historical accuracy, there are also tabs for the original layout, before the remodeling that expanded most of the rooms.
[2] Next years class may not be so lucky!
Reviews
There are no reviews yet.