Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. public void print() {
  2.  
  3. string[,] toPrint = new string[myMaze.GetLength(0), myMaze.GetLength(1)];
  4. for (int y = 0; y < myMaze.GetLength(1); y++)
  5. {
  6. for (int x = 0; x < myMaze.GetLength(0); x++)
  7. {
  8. if (x > 0)
  9. {
  10. if (y > 0)
  11. if (myMaze[x, y].getLinked().Contains(myMaze[x - 1, y - 1]))
  12. toPrint[x - 1, y - 1] = " ";
  13. else
  14. toPrint[x - 1, y - 1] = "#";
  15. if (y + 1 < myMaze.GetLength(1))
  16. if (myMaze[x, y].getLinked().Contains(myMaze[x - 1, y + 1]))
  17. toPrint[x - 1, y + 1] = " ";
  18. else
  19. toPrint[x - 1, y + 1] = "#";
  20. }
  21. if (x > 1 && x + 1 < myMaze.GetLength(0))
  22. {
  23. if (y > 0)
  24. if (myMaze[x, y].getLinked().Contains(myMaze[x - 1, y - 1]))
  25. toPrint[x + 1, y - 1] = " ";
  26. else
  27. toPrint[x + 1, y - 1] = "#";
  28. if (y + 1 < myMaze.GetLength(1))
  29. if (myMaze[x, y].getLinked().Contains(myMaze[x + 1, y + 1]))
  30. toPrint[x + 1, y + 1] = " ";
  31. else
  32. toPrint[x + 1, y + 1] = "#";
  33. }
  34. }
  35. }
  36. for (int y = 0; y < myMaze.GetLength(1); y++)
  37. {
  38. for (int x = 0; x < myMaze.GetLength(0); x++)
  39. {
  40. Console.Write(toPrint[x, y]);
  41. }
  42. Console.WriteLine();
  43. }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement