#ifndef __MAZE_H__ #define __MAZE_H__ #include #include "dir.h" #include "cell.h" class Maze { public: Maze( int width, int height ); ostream& print( ostream& os ); void reset(); void start(); bool move( Dir dir ); Cell& getCell(); bool isClear( Dir dir ); bool isGoal(); private: Cell& fetch( int x, int y ) { return cells[ y * width + x ]; } bool open( int x, int y, Dir dir ); bool nudge( int x, int y, Dir dir, int& nx, int& ny ); void generate(); Cell *cells; int width; int height; int cursor_col; int cursor_row; }; inline ostream& operator <<( ostream& os, Maze& maze ) { return maze.print( os ); } #endif // __MAZE_H__