Dungeon

Objectives

  • Modify a templated linked list from singly-linked to doubly-linked
  • Compile a program that requires several source files.
  • Test and debug complex code

Assignment

You have to finish the implementation of a linked list class. It currently is a singly linked list, but you must convert it into a doubly-linked list. When you get done, you should be able to pass all the tests in the test code, walk around in the dungeon, and possibly escape to the outside if you make the correct decisions in the dungeon. You have several files that you must work with. Make sure you add documentation to the documentation comments at the beginning of the file you have to modify: LinkedList.h.

  1. LinkedList.h: This is a templated linked list class. This is the file you have to finish. Comments in the file specify what you will have to do. Ask if you are unsure.
  2. dungeon.txt: This is a data file for the program to use. It defines the dungeon.
  3. PlayDungeon.cpp: This is the main file. It knows how to read the data file, construct the dungeon, display debugging information, ask the user for commands, and make the commands work.
  4. Dungeon.h: This file defines the Path, Item, Room, and Dungeon class headers.
  5. Dungeon.cpp: This is the implementation file for the Path, Item, Room, and Dungeon classes.
  6. These files are already on kermit (in ~dklick/examples/cis250/dungeon). You can get them into your home directory by copying them. I would suggest you make a new directory just for this project.
    • First, make sure you are in your home directory: cd
    • Make a new directory: mkdir dungeon
    • Make the new directory your current directory: cd dungeon
    • Copy the files: cp ~dklick/examples/cis250/dungeon/* .
  7. Once you are finished modifying the LikedList.h file, then compile and test.
    • To compile on kermit: g++ -Wall -o dung Dungeon.cpp PlayDungeon.cpp
    • To run it on kermit (w/o debugging info): ./dung
    • To run it on kermit (with debugging info): ./dung -d

Sample output

  • 3 points per spot (16) in LinkedList.h that has to be modified
  • 2 points gratis when everything is working properly

Sample output

Passed: default constructor test Passed: push_front(int) test Passed: push_back(int) test Passed: push(int) test Passed: peek_front() test Passed: peek_back() test Passed: peek() test Passed: insertAt(int, int) test Passed: deleteAt(int, int) test Passed: remove(int) test Passed: operator[] test Passed: copy constructor test Passed: pop() test Passed: pop_back() test Passed: pop_front() test Passed: pop* test Passed: contains() Passed: clear() test Passed: empty() test 19 tests attempted 0 errors encountered You are in the open computer lab A large room with many computers that are available to the public. Exits are: e, w, ne, nw, n, s Enter command: look You are in the open computer lab A large room with many computers that are available to the public. Exits are: e, w, ne, nw, n, s Enter command: n You are in A-1345a A large room filled with racks of routers and switches. Blinking lights and cables are everywhere. Exits are: s Enter command: s You are in the open computer lab Exits are: e, w, ne, nw, n, s Enter command: w You are in west hall intersection A long, carpeted hallway running north-south. Exits are: n, e, s, w, nw, ne Enter command: quit Thanks for playing. Visit again soon.