PathFinding.js icon indicating copy to clipboard operation
PathFinding.js copied to clipboard

Support one-dimensional array Grid

Open gugiserman opened this issue 6 years ago • 1 comments

I'm currently working on a project that renders a tile map based on a one-dimensional array as grid.

So I have to transform that array into a two-dimensional array in order to instantiate a Grid that can be used by the finders.

If I'm not mistaken, it seems that we could have a new Grid that knows how to handle a one-dimensional array while exposing the same API, or even extend PF.Grid to handle a one-dimensional grid argument.

I didn't read all of the finders yet but from what I've seen it would be possible to extend Grid in order to support one-dimensional arrays with no breaking changes to the finders, right?

gugiserman avatar Apr 16 '19 06:04 gugiserman

yes, it would be possible to rewrite the getNeighbors-function for this.

brean avatar Sep 01 '19 14:09 brean