Untitled
unknown
python
2 years ago
344 B
7
Indexable
def get_sorted_agents_list(self, order, availableAgents): sortedAgentsTuple = [] for agent in availableAgents: dist = math.dist(order.pos, agent.pos) sortedAgentsTuple.append((dist, agent)) sortedAgentsTuple.sort(key= lambda x: x[0]) return [agent[1] for agent in sortedAgentsTuple]
Editor is loading...