From b1c7b70aced064611adf8569349202abc313eec8 Mon Sep 17 00:00:00 2001 From: Dominik Zawadzki Date: Tue, 9 Jun 2020 12:26:23 +0000 Subject: [PATCH] Zaktualizuj 'main.py' --- main.py | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index e402baa..988c84d 100644 --- a/main.py +++ b/main.py @@ -32,6 +32,9 @@ if __name__ == "__main__": # Dominik check = 0 queue = [] + fromBar = 0 + barNode = (3, 12) + node = () # Marcin Dobrowolski suggestionTreeRoot = SuggestionTree.buildTree(trainingData) @@ -165,17 +168,31 @@ if __name__ == "__main__": path = waiter.translatePath(path) # Dominik - if check == 1: + if path == '' and fromBar == 0 and check == 1: task = queue.pop(0) - goal = (task[2][0], task[2][1]) - print(goal) - path = waiter.findPath(goal) - print(path) + tree.RemoveTask() + node = (task[2][0], task[2][1]) + if task[0] == "goToBar": + path = waiter.findPath(barNode) + fromBar = 1 + else: + path = waiter.findPath(node) path = waiter.translatePath(path) - print(path) - check = 0 + if fromBar == 1: + check = 0 - if len(queue) != 0 and check == 0 and path == '': + if path == '' and fromBar == 1: + path = waiter.findPath(node) + path = waiter.translatePath(path) + fromBar = 0 + + + if path != '': + nextStep = path[0] + path = path[1:] + waiter.travel(nextStep, graphics) + + if len(queue) != 0 and check == 0 and path == '' and fromBar == 0: check = 1 # AStar