Byakugan-js

Light-weight, array-based super simple A* pathfinding algorithm package written in Typescript, complied to Javascript in ES 5 syntax.

The name Byakugan (白眼) was influenced by the manga series Naruto.

                    npm install --save byakugan-js
                    copy
                

Features

Byakugan-js main features:

  • Simple API.
  • Written in object-oriented way make it easy to develop.
  • Easy to use and customize.

Quick start

Node.js

Install the following dependency:

npm install --save byakugan-js

Web

Choose one of the following CDNs:

Minified build:

<script src="https://cdn.jsdelivr.net/gh/rockmanvnx6/byakugan-js@master/dist/byakugan.min.js"></script>

Development build

<script src="https://cdn.jsdelivr.net/gh/rockmanvnx6/byakugan-js@master/dist/byakugan.js"></script>

Usage

                const Byakugan = require('byakugan-js'); // ignore if using CDN
const settings = {
    grid: [
        [1, 0, 0, 0],
        [1, 0, 0, 0],
        [0, 0, 0, 0],
        [0, 0, 0, 0],
        [0, 0, 1, 0],
        [1, 0, 0, 0],
    ],
    all: true,
    diagonal: false,
}
const byakugan = new Byakugan(settings)
const paths = byakugan.search(0,1,3,3); // Find path from grid[0][1] to grid[3][3]
            
                console.log(paths) // [ [1,1], [2,1], [2,2], [3,2], [3,3] ]
            

Contributions & APIs

For a full contributions guide and API usage, please visit Github.