Better debug output
This commit is contained in:
parent
569128763b
commit
4fff56bd7d
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user