/********************************************************************* C201 Computer Programming II Fall 2006 Dana Vrajitoru & A class to store a maze. **********************************************************************/ #ifndef MAZE_H #define MAZE_H #include using namespace std; const int SIZE = 15; enum Cell_ty {space, wall, food, target}; class Maze { private: Cell_ty table[SIZE][SIZE]; // The position of the player in the table. int player_x, player_y; public: // Desfault constructor initializing the whole table to spaces. Maze(); // Inputs the maze from a file and returns true if it was succesful. bool Read(char *filename); // Places the player in a random position on the board. Repeats the // operation until the player lands on a space. void Random_player(); // Moves the player up by one case. If the player is already at the // top or if the next cell going up is a wall, the movement is not // performed and the function returns false. bool Move_up(); // Moves in a direction specified by the char. If the movement is // not possible it returns false. bool Move(char dir); // Outputs the entire maze. friend ostream &operator<<(ostream &out, Maze &m); }; // Output operator for a cell type. ostream &operator<<(ostream &out, Cell_ty c); // input operator for a cell type. istream &operator>>(istream &in, Cell_ty &c); #endif