https://github.com/mark7888/path-finding
Basic recursive path finding algorithm for 2D matrix in python
https://github.com/mark7888/path-finding
Last synced: 4 months ago
JSON representation
Basic recursive path finding algorithm for 2D matrix in python
- Host: GitHub
- URL: https://github.com/mark7888/path-finding
- Owner: Mark7888
- License: mit
- Created: 2022-10-12T01:18:55.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-10-12T01:27:49.000Z (over 2 years ago)
- Last Synced: 2024-12-29T17:50:19.476Z (5 months ago)
- Language: Python
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Usage
```py
start = (3, 3)
end = (1, 2)matrix = [
['x', 'x', 'x', 'x', 'x', 'x', 'x'],
['x', '0', '2', '0', '0', '0', 'x'],
['x', '0', 'x', '0', 'x', '0', 'x'],
['x', '0', 'x', '0', 'x', '0', 'x'],
['x', '0', '0', '1', 'x', '0', 'x'],
['x', 'x', 'x', 'x', 'x', 'x', 'x'],
]matrix, route = find_path(matrix, start, end, barrier_char='x')
```
# Output
```
# path
[(3, 3), (2, 3), (1, 3), (1, 2), (1, 2)]# matrix
[
["x", "x", "x", "x", "x", "x", "x"],
["x", "x", "#", "#", "x", "x", "x"],
["x", "x", "x", "#", "x", "x", "x"],
["x", "x", "x", "#", "x", "x", "x"],
["x", "x", "x", "x", "x", "x", "x"],
["x", "x", "x", "x", "x", "x", "x"]
]
```