Exemple #1
0
 public static Direction getDirection(Cell source, Cell neighbor) {
   if (source.getX() < neighbor.getX()) {
     return Direction.EAST;
   } else if (source.getX() > neighbor.getX()) {
     return Direction.WEST;
   } else if (source.getY() < neighbor.getY()) {
     return Direction.SOUTH;
   } else {
     return Direction.NORTH;
   }
 }
Exemple #2
0
 public static boolean isNeighbors(Cell c1, Cell c2) {
   return (Math.abs(c1.getX() - c2.getX()) + Math.abs(c1.getY() - c2.getY())) == 1;
 }