append the taskslist

This commit is contained in:
s450026 2020-06-09 17:56:24 +02:00
parent d46137d634
commit 2f76d70270
2 changed files with 15 additions and 3 deletions

16
main.py
View File

@ -82,7 +82,7 @@ if __name__ == "__main__":
while True:
changePlate()
queue = addGuest()
#queue = addGuest()
for event in pygame.event.get():
# rabbit.check(waiter.matrix, waiter.X, waiter.Y)
@ -165,6 +165,18 @@ if __name__ == "__main__":
pygame.display.flip()
go = 0
if event.key == pygame.K_a:
newGuests.append(Guest(graphics))
guest = newGuests[len(newGuests) - 1]
goal = [0, 0]
goal[0] = guest.cord[0]
goal[1] = guest.cord[1]
tree.TasksList('order', goal, [waiter.X, waiter.Y])
tree.TasksList('goToBar', goal, [waiter.X, waiter.Y])
queue = tree.ReturnQueueList()
# Marcin Dobrowolski
if event.key == pygame.K_0:
newGuests.append(Guest(graphics))
@ -201,7 +213,9 @@ if __name__ == "__main__":
# Dominik
if queue and path == '' and fromBar == 0:
print(queue)
task = queue.pop(0)
print('tasks.{}'.format(task))
tree.RemoveTask()
node = (task[2][0], task[2][1])
if task[0] == "goToBar":

View File

@ -90,7 +90,6 @@ class DecisionTree:
#Dodawanie zadan do listy zadan
def TasksList(self, name, coordinate, waiterPos):
distance = []
print(waiterPos)
if name != "goToBar":
if self.matrix.matrix[coordinate[0] + 1][coordinate[1]].walk_through == 1:
distance.append([abs(coordinate[0] - (coordinate[0] + 1)) + abs(waiterPos[1] - coordinate[1]), [coordinate[0] + 1, coordinate[1] ]])
@ -142,7 +141,6 @@ class DecisionTree:
while queue[0][3] == '0':
queue.pop(0)
print(queue)
return queue
def RemoveTask(self):