-
Notifications
You must be signed in to change notification settings - Fork 74
A* might find a suboptimal path if the borders are passable #62
Copy link
Copy link
Closed
Description
Describe the bug
A* might find a suboptimal path if the borders are passable
To Reproduce
from pathfinding.core.grid import Grid
grid = Grid(width=5, height=5)
grid.set_passable_left_right_border()
start = grid.node(3, 2)
end = grid.node(0, 0)
from pathfinding.finder.a_star import AStarFinder
path, _ = AStarFinder().find_path(start, end, grid)
print(len(path))
print(grid.grid_str(path=path, start=start, end=end))6
+-----+
|exxx |
| x |
| s |
| |
| |
+-----+
Expected behavior
A* finds the optimal path
from pathfinding.finder.breadth_first import BreadthFirstFinder
path, _ = BreadthFirstFinder().find_path(start, end, grid)
print(len(path))
print(grid.grid_str(path=path, start=start, end=end))5
+-----+
|e xx|
| x |
| s |
| |
| |
+-----+
Screenshots / Map / Log
_
Environment (please complete the following information):
- Environment: Ubuntu 24.04
- Python version: 3.11
- Pathfinding Version: 1.0.11
Additional context
_
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels