Finding "Walkable" Neighbors

This function is just a variant of the last one that just make sure at least four of a spot's nearby nodes are represented in the list of neighbor links:

  
  let walkingNeighbors :: Int -> [Point] -> [Link] 
      walkingNeighbors n l = nub $ concatMap myNeighbors l
          where myNeighbors :: Point -> [Link] 
                myNeighbors p = shortestLinks n [sort [p,c] | c <- l, p /= c]

  let walking = walkingNeighbors 4 centers

  writeFile "tut7.svg" $ writePolygons $ (green park) ++ spots ++ (red walking)

Note that with this function, the islands are now more like peninsulas (or perhaps jetties... or maybe enclaves would be more appropriate... definitely not buttes, though...) This is the function we'll use for "walking around".


NEXT