a-star-finder
Generic synchronous/asynchronous A* search algorithm.
How to use
// sync versionconst getPath = ; const map = '··S·###···' // S and E - Start and End, not required, here is for example only '····#·····' // · - available to across square, not required, here is for example only '····#E##··' // # - NOT AVAILABLE to across square, REQUIRED '····###···' '··········'; const start = 2 0; // x and y coordinates, start of pathconst end = 5 2; // x and y coordinates, end of pathconst path = ; console; // array of square's coordinates [start, [3, 0], [3, 1], ..., [6, 1], [5, 1], end] // getPath support options; // noPath will used instead of default not across square // async versionconst getPathAsync = ; // getPathAsync support options: getPathAsync(map, start, end, callback, options);
If end point is unreachable, return null.