Untitled
unknown
python
3 years ago
344 B
8
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...