diff --git a/astar.py b/astar.py index 599bb55..0447a8d 100644 --- a/astar.py +++ b/astar.py @@ -51,7 +51,8 @@ class Node: if self.walkable: return self.g_cost + self.h_cost else: - return math.inf + return 0 + # return math.inf class Pathfinding: @@ -107,7 +108,8 @@ class Pathfinding: self.path = path for neighbour in self.succ(current_node): - if not neighbour.walkable or neighbour in explored: + # if not neighbour.walkable or neighbour in explored: + if neighbour in explored: continue new_movement_cost_to_neighbour = current_node.g_cost + self.get_distance(current_node,neighbour) if new_movement_cost_to_neighbour < neighbour.g_cost or not neighbour in fringe: