brean / python-pathfinding

Implementation of common pathfinding algorithms
https://brean.github.io/svelte-pyscript-pathfinding
MIT License
310 stars 63 forks source link

Add elevators/ladders, steps and portals #38

Open brean opened 1 year ago

brean commented 1 year ago

Implement and describe ways to go from one grid to another, e.g. for different level of a building:

Also add a markdown-page with a description describing the problem and how to use it.

For the implementation you need to extend the Node to have a list of connecting nodes in other grids. Then you need to inherit the Grid class and extend the check_neighbors function to look for those connections after all other neighbors are checked. Because for the algorithm the path isn't stored as a grid but as a graph where all neighboring cells are seen as edges so you just need another edge in the other grid.

brean commented 1 year ago

First iteration here: https://github.com/brean/python-pathfinding/commit/1278ff8b147f6501e83c53fe1f1167c427fa7287, we maybe also want to add a way to create new portals from a grid-like data structure

brean commented 1 year ago

...also add more examples, also visual ones (multiple level in https://github.com/brean/svelte-pyscript-pathfinding )