Dungeon

Objectives

  • Create code to implement a doubly linked list (from a singly linked list)
  • Compile an application that uses several source files
  • Test and debug a complex application

Requirements and Resources

You have to modify the LinkedList class for this assignment. You have to convert it from being a singly-linked list class to a doubly-linked list class. There are comments in the source code (marked with ***) that indicate where modifications are needed.

Once you have modified LinkedList.java, you can compile it and run it. It has a built in test when run on its own.

Once you have the LinkedList class, you can then compile it with the rest of the programs linked to this assignment, and then run PlayDungeon. The dungeon.txt file is a data file used by PlayDungeon to create the dungeon. Can you figure out how to escape from the dungeon to the great outdoors?

  • LinkedList.java: A generic singly-linked list class you are required to modify to become a doubly-linked list class.
  • dungeon.txt: The data file used to populate the dungeon
  • Item.java: A class representing an object in the dungeon.
  • Path.java: A class representing a connection between rooms in the dungeon.
  • Room.java: A class representing a room/place in the dungeon.
  • Dungeon.java: A class representing the dungeon itself.
  • PlayDungeon.java: The main program that runs game

Rubric

Note: The term "pointer" is used loosely since we are using a reference variable rather than a true pointer as in C/C++.

  • (5 pts) Previous "pointers" taken care of in Node class
  • (4 pts) pop_front() method modified correctly
  • (4 pts) pop_back() method modified correctly
  • (5 pts) push_front(T) method modified correctly
  • (5 pts) push_back(T) method modified correctly
  • (8 pts) remove(T) method modified correctly
  • (11 pts) insert_at(int, T)
  • (8 pts) delete_at(int)

Sample output: LinkedList

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: set(int, T) 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 Passed tests: true

Sample output: PlayDungeon

You are in a large 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 telecom room A large room filled with racks of routers and switches. Blinking lights and cables are everywhere. Exits are: s Enter command: w Unknown command. Try again. You are in telecom room Exits are: s Enter command: s You are in a large open computer lab Exits are: e, w, ne, nw, n, s Enter command: w You are in the west hall intersection A long, carpeted hallway running north-south. Exits are: n, e, s, w, nw, ne Enter command: inv You are carrying: nothing You are in the west hall intersection Exits are: n, e, s, w, nw, ne Enter command: look You are in the 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.