Advertisement
Pietu1998

Magic. Prim's Algorithm

Dec 25th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             // Magic. Don't touch.
  2.             if (x % 2 + y % 2 == 0) {
  3.                 if (Wall.has(result, new Wall(x / 2 - 1, y / 2 - 1, x / 2, y / 2 - 1)))
  4.                     dirs |= UP
  5.                 if (Wall.has(result, new Wall(x / 2 - 1, y / 2, x / 2, y / 2)))
  6.                     dirs |= DOWN
  7.                 if (Wall.has(result, new Wall(x / 2 - 1, y / 2 - 1, x / 2 - 1, y / 2)))
  8.                     dirs |= LEFT
  9.                 if (Wall.has(result, new Wall(x / 2, y / 2 - 1, x / 2, y / 2)))
  10.                     dirs |= RIGHT
  11.             }
  12.  
  13. // ...
  14.  
  15.             // Magic. Don't touch.
  16.             if (Walls.has(result, new Wall(x, y, x + 1, y))
  17.                 grid[2 * x + 2][2 * y + 1] = BOXCHARS[UP | DOWN];
  18.             if (Walls.has(result, new Wall(x, y, x, y + 1))
  19.                 grid[2 * x + 1][2 * y + 2] = BOXCHARS[LEFT | RIGHT];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement