예제 #1
0
	def get_random_location(self, in_range):
		"""Returns a random location in walking_range, that we can find a path to
		@param in_range: int, max distance to returned point from current position
		@return: Instance of Point or None"""
		possible_walk_targets = Circle(self.position, in_range).get_coordinates()
		possible_walk_targets.remove(self.position.to_tuple())
		self.session.random.shuffle(possible_walk_targets)
		for coord in possible_walk_targets:
			target = Point(*coord)
			if self.check_move(target):
				return target
		return None
예제 #2
0
    def get_random_location(self, in_range):
        """Returns a random location in walking_range, that we can find a path to
		@param in_range: int, max distance to returned point from current position
		@return: Instance of Point or None"""
        possible_walk_targets = Circle(self.position,
                                       in_range).get_coordinates()
        possible_walk_targets.remove(self.position.to_tuple())
        self.session.random.shuffle(possible_walk_targets)
        for coord in possible_walk_targets:
            target = Point(*coord)
            if self.check_move(target):
                return target
        return None