00001 #ifndef _Builder_h_ 00002 #define _Builder_h_ 00003 00004 #include "Maze.h" 00005 /* 00006 */ 00007 class Wall; 00008 class Room; 00009 class Door; 00010 00011 class MazeBuilder { 00012 public: 00013 virtual void BuildMaze() { } 00014 virtual void BuildRoom(int room) { } 00015 virtual void BuildDoor(int roomFrom, int roomTo) { } 00016 00017 virtual Maze* GetMaze() { return 0; } 00018 protected: 00019 MazeBuilder() {} 00020 }; 00021 00022 class StandardMazeBuilder : public MazeBuilder { 00023 public: 00024 StandardMazeBuilder(); 00025 /* 00026 */ 00027 virtual void BuildMaze(); 00028 virtual void BuildRoom(int); 00029 virtual void BuildDoor(int, int); 00030 /* 00031 */ 00032 virtual Maze* GetMaze(); 00033 private: 00034 Direction CommonWall(Room*, Room*) 00035 { 00036 //TODO 00037 //CommonWall is a utility operation that determines 00038 //the direction of the common wall between two rooms 00039 return East; 00040 } 00041 Maze* _currentMaze; 00042 }; 00043 00044 /* 00045 */ 00046 class CountingMazeBuilder : public MazeBuilder { 00047 public: 00048 CountingMazeBuilder(); 00049 /* 00050 */ 00051 virtual void BuildMaze(); 00052 virtual void BuildRoom(int); 00053 virtual void BuildDoor(int, int); 00054 virtual void AddWall(int, Direction); 00055 /* 00056 */ 00057 void GetCounts(int&, int&) const; 00058 private: 00059 int _doors; 00060 int _rooms; 00061 }; 00062 00063 #endif