// File : wumpus.cpp // Author: Dave Reed // // This program uses the CaveMaze class to play "Hunt the Wumpus". ////////////////////////////////////////////////////////////////// #include #include #include #include "CaveMaze.h" using namespace std; const string MAZE_FILE = "caves.dat"; void DisplayIntro(); int main() { CaveMaze maze(MAZE_FILE); DisplayIntro(); while (maze.StillAlive() && maze.StillWumpi()) { maze.ShowLocation(); char action; int target; cout << endl << "What do you want to do? "; cin >> action >> target; if (action == 't') { maze.Toss(target); } else { maze.Move(target); } } cout << endl << "GAME OVER" << endl; return 0; } //////////////////////////////////////////////////////////////// void DisplayIntro() // Results: displays an introduction to the game { cout << "HUNT THE WUMPUS: Your mission is to explore the " << "maze of caves" << endl; cout << "and destroy all of the wumpi (without getting " << "yourself killed)." << endl; cout << "To move to an adjacent cave, enter 'M' and the " << "tunnel number." << endl; cout << "To toss a grenade into a cave, enter 'T' and the " << "tunnel number." << endl; }