public int[,] Generate() { gg = new GridGraph(width, height); Build(); //Printer.PrintGridGraph(gg); Level++; int[,] fullMap = new int[height + 2, width + 2]; int[,] cellArray = gg.GetCellArray(); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { fullMap[j + 1, i + 1] = cellArray[i, j]; } } for (int i = 0; i < width + 2; i++) { fullMap[0, i] = 1; fullMap[height + 1, i] = 1; } for (int j = 1; j < height + 1; j++) { fullMap[j, 0] = 1; fullMap[j, width + 1] = 1; } fullMap[0, width / 2 + 1] = 0; return(fullMap); }
public static void PrintGridGraph(GridGraph gg) { int[,] nums = gg.GetCellArray(); for (int i = 0; i < gg.Height; i++) { for (int j = 0; j < gg.Width; j++) { if (nums[j, i] == 1) { Console.ForegroundColor = ConsoleColor.DarkGray; } else { Console.ForegroundColor = ConsoleColor.Yellow; } Console.Write(nums[j, i] + " "); } Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; } }