Exemplo n.º 1
0
 def position_is_free(self, position):
     if distance_from_points(position, self._host.get_position()) > self._feel_distance:
         raise Exception("Can't feel so far")
     return self._grid.is_free(position)
Exemplo n.º 2
0
 def _order_by_far_away(self, positions):
     last_walked_pos = self.get_last_memory_since_blocked()[1]
     return sorted(positions, key=lambda pos: distance_from_points(last_walked_pos, pos), reverse=True)