void Generate() { roomBuilder.ClearAllTiles(); // Run the algorithm. int[,] map = Walk(); map = Merge4(map); map = Merge2(map); // Place a rectangle to represent each room. for (int y = 0; y < map.GetLength(1); y++) { for (int x = 0; x < map.GetLength(0); x++) { roomBuilder.BuildRoom(x, y, map); } } }