private void burrowCave(Point point,LayerDefinition layer){
  Queue<Point> branchPoints=new LinkedList<Point>();
  HashSet<Point> visited=new HashSet<Point>();
  branchPoints.add(point);
  List<Point> neighbours=getUnvisitedNeighbours(point,visited);
  do {
    visited.add(point);
    if (neighbours.size() > 0) {
      Point next=Rand.rand(neighbours);
      branchPoints.add(next);
      int diffx=Integer.signum(next.x - point.x);
      int diffy=Integer.signum(next.y - point.y);
      for (int i=1; i <= WALL_THICKNESS; i++) {
        setCollide(layer,point.x + i * diffx,point.y + i * diffy,false);
      }
      point=next;
    }
 else {
      point=branchPoints.poll();
    }
    neighbours=getUnvisitedNeighbours(point,visited);
  }
 while (point != null);
}

private void burrowCave ( Point point , LayerDefinition layer ) { Queue < Point > branchPoints = new LinkedList < Point > ( ) ; HashSet < Point > visited = new HashSet < Point > ( ) ; branchPoints . add ( point ) ; List < Point > neighbours = getUnvisitedNeighbours ( point , visited ) ; do { visited . add ( point ) ; if ( neighbours . size ( ) > 0 ) { Point next = Rand . rand ( neighbours ) ; branchPoints . add ( next ) ; int diffx = Integer . signum ( next . x - point . x ) ; int diffy = Integer . signum ( next . y - point . y ) ; for ( int i = 1 ; i <= WALL_THICKNESS ; i ++ ) { setCollide ( layer , point . x + i * diffx , point . y + i * diffy , false ) ; } point = next ; } else { point = branchPoints . poll ( ) ; } neighbours = getUnvisitedNeighbours ( point , visited ) ; } while ( point != null ) ; }
make the tunnels . the actual maze generation algorithm .
