cave implementation, refactoring of neighbors
cave implementation