#ifndef SQRMAZE_H
#define SQRMAZE_H

//      Each instance of this class is a maze having square rooms.

//      This class uses the classes "cell" (room of a maze) and "oracle"
// (random number generator).

class sqrmaze
  {
    private:
      oracle       *column_selector;
//      Random number generator to select column to start constructing maze.

      struct
        {
           int row_num;
           int column_num;
        }          current;
//      Current location in maze.

      struct
        {
           int row_num;
           int column_num;
        }          first;
//      Location of the starting room.

      int          memory_allocated;
//      The two dimensional array of rooms has been allocated.

      int          num_columns;
//      Number of columns in maze.

      int          num_rows;
//      Number of rows in maze.

      oracle       *order_selector;
//      Random number generator to select the order walls are to considered.

      cell         **room;
//      Two dimensional array of rooms composing the maze.

      oracle       *row_selector;
//      Random number generator to select row to start constructing maze.

      int          wall_thickness;
//      Thickness of wall.

      TFrameWindow *window_ptr;
    public:

      int    constructed(void) {return memory_allocated;}
//      Return TRUE if and only if the maze is successfully constructed.

      int    external_to_maze(double x,double y);
//      Return TRUE if and only if a point (x,y) is external to the maze.

      double f(double x,double y);
//      Return 6.0*wall_thickness if a point (x,y) is on a wall, 0.0 otherwise.

             sqrmaze(int row_count,int column_count,int thickness_of_wall,
              char *seed,TFrameWindow *win_ptr);
//      Contruct a maze having "row_count" rows and "column_count" columns of
// rooms.  The walls should be "thickness_of_wall" (bricks) thick.  A different
// (8 character of less) "seed" generally yields a different maze.

             ~sqrmaze(void);

      int    maze_okay(void);
//      TRUE if and only if solving the maze is difficult enough.

      int    num_x_divisions(void)
              {return 3*wall_thickness*num_rows+wall_thickness+2;}
//      Recommended number of x divisions for plotting f(x,y).

      int    num_y_divisions(void)
              {return 3*wall_thickness*num_columns+wall_thickness+2;}
//      Recommended number of y divisions for plotting f(x,y).

      int    part_of_solution(double x,double y);
//      Return TRUE if and only if a point (x,y) is on a wall outlining the
// solution to the maze.

      double x_max(void)
              {return double(3*wall_thickness*num_rows+wall_thickness);}
//      Recommended maximum value of x for plotting f(x,y).

      double x_min(void) {return(-1.0);}
//      Recommended minimum value of x for plotting f(x,y).

      double y_max(void)
              {return double(3*wall_thickness*num_columns+wall_thickness);}
//      Recommended maximum value of y for plotting f(x,y).

      double y_min(void) {return(-1.0);}
//      Recommended minimum value of y for plotting f(x,y).
  };

#endif
