Module ROT.Path.Dijkstra
Dijkstra Pathfinding.
Simplified Dijkstra's algorithm: all edges have a value of 1
Functions
init (toX, toY, passableCallback, options) | Constructor. |
compute (fromX, fromY, callback) | Compute the path from a starting point |
Functions
- init (toX, toY, passableCallback, options)
-
Constructor.
Parameters:
- toX int x-position of destination cell
- toY int y-position of destination cell
- passableCallback function Function with two parameters (x, y) that returns true if the cell at x,y is able to be crossed
- options Options
- topology int Directions for movement Accepted values (4 or 8) (default 8)
- compute (fromX, fromY, callback)
-
Compute the path from a starting point
Parameters:
- fromX int x-position of starting point
- fromY int y-position of starting point
- callback function Will be called for every path item with arguments "x" and "y"