def _get_closest_island_distance(self, action): next_move_segment = Segment(self._world_map.robot.get_center(), action.destination) closest_island = self._get_closest_island_from_segment( next_move_segment) if closest_island is None: return None return next_move_segment.distance( closest_island.get_center()) - closest_island.get_size() / 2