int main(int argc, char** argv) { Maze* maze; MazeGame game; StandardMazeBuilder builder; CountingMazeBuilder countBuilder; game.CreateMaze(builder); maze = builder.GetMaze(); game.CreateMaze(countBuilder); cout << "room size in maze : " << maze->RoomSize() << endl; int roomNum, doorNum; countBuilder.GetCounts(roomNum,doorNum); cout << "room Num : " << roomNum << " door Num: " << doorNum << endl; }
int main() { //利用StandardMazeBuilder创建迷宫 Maze* maze; MazeGame game; StandardMazeBuilder builder; game.CreateMaze(builder); maze = builder.GetMaze(); //利用CountingMazeBuilder对迷宫的部件进行计数 int rooms, doors; CountingMazeBuilder cbuilder; game.CreateMaze(cbuilder); cbuilder.GetCounts(rooms, doors); cout << "The maze has " << rooms << " rooms and " << doors << " doors" << endl; system("pause"); return 0; }