python-pathfinding
python-pathfinding copied to clipboard
Grid does not allow an algorithm to make a diagonal crossing over a border
Describe the bug Grid does not allow an algorithm to make a diagonal crossing over a border
To Reproduce
from pathfinding.core.grid import Grid, DiagonalMovement
grid = Grid(5, 5)
grid.set_passable_left_right_border()
nb = grid.neighbors(grid.node(4, 2), DiagonalMovement.always)
print([(n.x, n.y) for n in nb])
print(grid.grid_str(path=nb))
[(4, 1), (0, 2), (4, 3), (3, 2), (3, 1), (3, 3)]
+-----+
| |
| xx|
|x x |
| xx|
| |
+-----+
Expected behavior I want to make diagonal crossings over a border. The code above should return:
[(4, 1), (0, 2), (4, 3), (3, 2), (3, 1), (3, 3), (0, 1), (0, 3)]
+-----+
| |
|x xx|
|x x |
|x xx|
| |
+-----+
Screenshots / Map / Log _
Environment (please complete the following information):
- Environment: Ubuntu 22.04
- Python version 3.10
- Pathfinding Version 1.0.9
Additional context _