From 4fff56bd7d85921d08484826bcf8ef20f20f991d Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Fri, 15 May 2020 08:52:06 +0200 Subject: [PATCH] Better debug output --- src/AI/AutomaticMovement.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/AI/AutomaticMovement.py b/src/AI/AutomaticMovement.py index 667042a..a093576 100644 --- a/src/AI/AutomaticMovement.py +++ b/src/AI/AutomaticMovement.py @@ -129,7 +129,7 @@ def aStar(movable: Entity, target, map): :return: Array of moves """ testCount = 0 - + print("Couldn't find path to x:", target.x, " y:", target.y, end='...\n') fringe = PriorityQueue() explored = [] @@ -141,13 +141,13 @@ def aStar(movable: Entity, target, map): while True: if fringe.empty(): # target is unreachable - print("PATH NOT FOUND") + print("Couldn't find path to x:", target.x, " y:", target.y, end='.\n') return None elem: AStarNode = fringe.get()[2] if goalTest(elem.state, target): - print("PATH FOUND") + print("Found path to x:", target.x, " y:", target.y, end='.\n') movesList = [] if isinstance(target, Entity) or target in map.collidables: @@ -160,21 +160,6 @@ def aStar(movable: Entity, target, map): movesList.reverse() return movesList - # debug - # print("DEBUG") - print("ACTUAL STATE: {}".format(elem.state)) - print("HOW TO GET HERE:") - temp = elem - while temp.action is not None: - print(temp.action) - temp = temp.parent - # - # print("POSSIBLE MOVEMENTS FROM HERE:") - # for el in self.successor(elem.state): - # print(el) - # - # print("*" * 20) - explored.append(elem) for (movement, newState) in successor(movable, elem.state, map, target):