priority optimization

This commit is contained in:
Vadzim Valchkovich 2023-06-10 15:43:48 +02:00
parent 2e79464483
commit c5e626a772
2 changed files with 10 additions and 4 deletions

View File

@ -147,6 +147,9 @@ class Engine:
goal_queue = PriorityQueue() goal_queue = PriorityQueue()
# sorting objects by distance to waiter
self.objects.sort(key=lambda o: o.distance_to(self.user.obj.position))
for o in self.objects: for o in self.objects:
condition = o.agent_role in [ condition = o.agent_role in [

View File

@ -23,10 +23,13 @@ class Object:
def get_angle(self): def get_angle(self):
''' '''
orientation = 0 -> up\n orientation = 0 -> up
orientation = 1 -> left\n
orientation = 2 -> down\n orientation = 1 -> left
orientation = 3 -> right\n
orientation = 2 -> down
orientation = 3 -> right
''' '''
return self.orientation * 90 return self.orientation * 90