Homework 7

Make a class called Room and a main() function that allow a user to “walk through a maze.” Here is an example interaction:

You are in the Garden. The trees and shrubs appear to be resilient to
decades of neglect but the flowerbeds all withered away long ago.

There is an exit to North (Kitchen) and East (Library).

Which exit? (or 'quit'): north

You move to the North...

You are in the Kitchen. Knives, pots, pans, and other kitchenware
dangle over the island like some kind of metallic chandelier.

There is an exit to North (Hallway), East (Library), and South
(Garden).

Which exit? (or 'quit'): west

There is nothing over there.

Which exit? (or 'quit'): east

You move to the East...

The Room class should have at least these methods:

You should support room links in North, South, East, and West directions (at least). Use a map (key is the direction, a string; value is the Room pointer).

You can establish the maze in the code (in the main() function probably); the maze need not be designed by the user interactively (that would be slightly harder).

There is no particular need for polymorphism in this program’s code, but you should use private and public data/methods in your class (make a meaningful separation). Also, split your code into three files: room.h, room.cpp, and main.cpp.

This may be interesting if you have some free time: http://www.kongregate.com/games/2DArray/you-find-yourself-in-a-room

You can also play the original (updated to be played in a browser) Colossal Cave Adventure

CSE 230 material by Joshua Eckroth is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Source code for this website available at GitHub.