Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.46 KB | None | 0 0
  1.     public static int blocked(int x, int y, char d)
  2.     {
  3.         switch (d)
  4.         {
  5.             case 'N':
  6.                 Triple pN = new Triple(x, y, 'N');
  7.                 Triple pS = new Triple(x, y + 1, 'S');
  8.                 if (blocks.containsKey(pN) || blocks.containsKey(pS))
  9.                     return 0;
  10.                 return 1;
  11.  
  12.             case 'E':
  13.                 Triple pE = new Triple(x, y, 'E');
  14.                 Triple pW = new Triple(x + 1, y, 'W');
  15.                 if (blocks.containsKey(pE) || blocks.containsKey(pW))
  16.                     return 0;
  17.                 return 1;
  18.         }
  19.         return 1;
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement