Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void print() {
- string[,] toPrint = new string[myMaze.GetLength(0), myMaze.GetLength(1)];
- for (int y = 0; y < myMaze.GetLength(1); y++)
- {
- for (int x = 0; x < myMaze.GetLength(0); x++)
- {
- if (x > 0)
- {
- if (y > 0)
- if (myMaze[x, y].getLinked().Contains(myMaze[x - 1, y - 1]))
- toPrint[x - 1, y - 1] = " ";
- else
- toPrint[x - 1, y - 1] = "#";
- if (y + 1 < myMaze.GetLength(1))
- if (myMaze[x, y].getLinked().Contains(myMaze[x - 1, y + 1]))
- toPrint[x - 1, y + 1] = " ";
- else
- toPrint[x - 1, y + 1] = "#";
- }
- if (x > 1 && x + 1 < myMaze.GetLength(0))
- {
- if (y > 0)
- if (myMaze[x, y].getLinked().Contains(myMaze[x - 1, y - 1]))
- toPrint[x + 1, y - 1] = " ";
- else
- toPrint[x + 1, y - 1] = "#";
- if (y + 1 < myMaze.GetLength(1))
- if (myMaze[x, y].getLinked().Contains(myMaze[x + 1, y + 1]))
- toPrint[x + 1, y + 1] = " ";
- else
- toPrint[x + 1, y + 1] = "#";
- }
- }
- }
- for (int y = 0; y < myMaze.GetLength(1); y++)
- {
- for (int x = 0; x < myMaze.GetLength(0); x++)
- {
- Console.Write(toPrint[x, y]);
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement