zmiany na potrzebe prezentacji. Wykrywanie trasy przez półki
This commit is contained in:
parent
e8dfdfda68
commit
676b9c49c5
6
astar.py
6
astar.py
@ -51,7 +51,8 @@ class Node:
|
|||||||
if self.walkable:
|
if self.walkable:
|
||||||
return self.g_cost + self.h_cost
|
return self.g_cost + self.h_cost
|
||||||
else:
|
else:
|
||||||
return math.inf
|
return 0
|
||||||
|
# return math.inf
|
||||||
|
|
||||||
|
|
||||||
class Pathfinding:
|
class Pathfinding:
|
||||||
@ -107,7 +108,8 @@ class Pathfinding:
|
|||||||
self.path = path
|
self.path = path
|
||||||
|
|
||||||
for neighbour in self.succ(current_node):
|
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
|
continue
|
||||||
new_movement_cost_to_neighbour = current_node.g_cost + self.get_distance(current_node,neighbour)
|
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:
|
if new_movement_cost_to_neighbour < neighbour.g_cost or not neighbour in fringe:
|
||||||
|
Loading…
Reference in New Issue
Block a user