1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
#include <iostream>
#include <cstdlib>
#include "maze.h"
using namespace std;
int main(int argc, char *argv[])
{
system("color 78");
cout << " _| _| _|_| _|_|_|_|_| _|_|_|_| \n"
<< " _|_| _|_| _| _| _| _| \n"
<< " _| _| _| _|_|_|_| _| _|_|_| \n"
<< " _| _| _| _| _| _| \n"
<< " _| _| _| _| _|_|_|_|_| _|_|_|_| \n\n\n"
<< " _|_|_| _|_| _| _| _|_|_|_| \n"
<< " _| _| _| _|_| _|_| _| \n"
<< " _| _|_| _|_|_|_| _| _| _| _|_|_| \n"
<< " _| _| _| _| _| _| _| \n"
<< " _|_|_| _| _| _| _| _|_|_|_| \n";
cout << " Welcome to the Maze Game\n";
system("PAUSE");
//create rooms
Room *a = new Room('A');
Room *b = new Room('B');
Room *c = new Room('C');
Room *d = new Room('D');
Room *e = new Room('E');
Room *f = new Room('F');
Room *g = new Room('G');
Room *h = new Room('H');
Room *i = new Room('I');
Room *j = new Room('J');
Room *k = new Room('K');
Room *l = new Room('L');
//set directions
a->setDirection(NULL, b, e, NULL);
b->setDirection(NULL, NULL, f, a);
c->setDirection(NULL, d, g, NULL);
d->setDirection(NULL, NULL, c, NULL);
e->setDirection(a, NULL, i, NULL);
f->setDirection(b, g, NULL, NULL);
g->setDirection(c, h, k, f);
h->setDirection(NULL, NULL, l, g);
i->setDirection(e, j, NULL, NULL);
j->setDirection(NULL, NULL, i, NULL);
k->setDirection(g, NULL, NULL, NULL);
l->setDirection(h, NULL, NULL, NULL);
int Counter=0;
int Score=0;
Room *current = a;
Room *next;
char userChoice;
do
{
current->roomProperties();
cin >> userChoice;
next = current->moveDirection(userChoice);
Counter++;
if (NULL != next)
current = next;
}
while (current->getName() != 'L');
if (Counter= 5) Score = 1000;
if (Counter >5 && Counter <8) Score = 600;
if (Counter >8 && Counter <12) Score = 300;
if (Counter >12 && Counter <15) Score = 150;
if (Counter >15) Score = 0;
cout << "********************************************************\n"
<< "* YOU HAVE MADE IT TO ROOM L.....YOU WIN!! *\n"
<< "********************************************************\n"
<< "* You made it to Room L in " << Counter << " moves *\n"
<< "********************************************************\n"
<< "* Your Score is " << Score << " *\n"
<< "********************************************************\n"
<< "* _._._ _._._ *\n"
<< "* _| |_ _| |_ *\n"
<< "* | ... |_._._._._._._._._._._| ... | *\n"
<< "* | ||| | o FREEDOM o | ||| | *\n"
<< "* ()) |[-|-]| [-|-] [-|-] [-|-] |[-|-]| ()) *\n"
<< "* (())) | |---------------------| | (())) *\n"
<< "* (()))()|[-|-]| ::: .-\"-. ::: |[-|-]|(()))() *\n"
<< "* ()))(()| | |~|~| |_|_| |~|~| | |()))(() *\n"
<< "* || |_____|_|_|_|__|_|_|__|_|_|_|_____| || *\n"
<< "* ~ ~^^ /=======\\ ^^~ ~ *\n"
<< "* ^~^~ ~^~^ *\n"
<< "* *\n"
<< "********************************************************\n";
system("PAUSE");
return 0;
}
| |