let connect_cave cave = let xy = getvalidxy cave in connect_cave' cave xy (connected cave (IntPairSet.add xy IntPairSet.empty))