Untitled

Anonymous
python
11/10/2022 10:13 PM
460 B
18
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...