// @topic W15-7-020 maze game
// @brief main driver program
#include <cstdlib>
#include "maze.h"
int main()
{
// configure the maze
Maze maze;
Room room1;
Room room2;
Room room3;
Door door12( DIR_NORTH, room1, room2 );
Door door23( DIR_EAST, room2, room3 );
maze.add( room1 );
maze.add( room2 );
maze.add( room3 );
// create visitor to navigate the maze
Visitor visitor( maze );
// begin navigation...
visitor.look_around(); // shows what the visitor can see in the room
int steps = visitor.move_forward(); // attempt to move forward
std::cout << "\n\t\t Moved " << steps << " steps forward\n\n";
visitor.look_around();
steps = visitor.move_forward();
std::cout << "\n\t\t Moved " << steps << " steps forward\n\n";
visitor.look_around();
std::cout << "\n\t\t Turning right\n\n";
visitor.turn_right();
visitor.look_around();
steps = visitor.move_forward();
std::cout << "\n\t\t Moved " << steps << " steps forward\n\n";
visitor.look_around();
// TODO:
// write code to interact with the user through the command interface,
// e.g. accept command such as "go", "left", "right", "back", and so on.
// TODO:
// write a "crawl spider" algorithm for a visitor, so the visitor
// can visit all rooms accessible in the maze layout
system( "pause" ); // stop before exiting
return 0;
}
/*
Program output:
Visitor facing NORTH at location 0
ahead: door
left: wall
right: wall
good move!
Moved 1 steps forward
Visitor facing NORTH at location 1
ahead: wall
left: wall
right: door
*** bad move
Moved 0 steps forward
Visitor facing NORTH at location 1
ahead: wall
left: wall
right: door
Turning right
Visitor facing EAST at location 1
ahead: door
left: wall
right: door
good move!
Moved 1 steps forward
Visitor facing EAST at location 2
ahead: wall
left: wall
right: wall
Press any key to continue . . .
*/