-
-
Notifications
You must be signed in to change notification settings - Fork 263
Description
Looking at the documentation, the Dijkstra routine for rot.js seems to accept a starting position and an ending position (among other things) and tells you the path between the two. I think this could potentially be made a bit more flexible through an alternate set of input parameters. The Dijkstra algorithm (unlike A*) is capable of handling multiple possible ending positions by basically just stopping at the first ending position you find. So rather than providing a single ending position, could we instead pass in a callback that takes in an x,y position and returns a boolean telling you whether or not it found one of the ending points? This would be of use in, for example, implementing an auto-explore system. In order to find the nearest unexplored tile to walk to, just have your ending callback return 1 if the tile at x,y is unexplored and 0 if it is not.
As a side note, it should also be possible to have multiple possible starting positions for Dijkstra as well, although I can't really think of any great use cases for that off the top of my head.