From 676b9c49c537fb34482782c1dd5421c4cc862d4a Mon Sep 17 00:00:00 2001 From: tonywesoly Date: Fri, 29 Apr 2022 08:59:52 +0200 Subject: [PATCH] =?UTF-8?q?zmiany=20na=20potrzebe=20prezentacji.=20Wykrywa?= =?UTF-8?q?nie=20trasy=20przez=20p=C3=B3=C5=82ki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astar.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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: