node-astar icon indicating copy to clipboard operation
node-astar copied to clipboard

document impassability

Open tomprogers opened this issue 2 years ago • 0 comments

Describe in the API docs how to use the options to make a node impassable.

Consider this grid:

┌───┐
│ A │
├───┤
│   │
├───┤
│ B │
└───┘

Where:

  • empty cells should be impassable -- walls, mountains, lava, force-field, whatever
  • the caller wants to ask for a path from cell A to cell B, which ought to be impossible

It appears this cannot be accomplished by the distance function, e.g. by returning Number.POSITIVE_INFINITY as the cost for entering an impassable node. Instead, it seems like the neighbor function must choose to omit nodes which should be treated as impassable.

tomprogers avatar Sep 12 '22 05:09 tomprogers