{"id":16634993,"url":"https://github.com/auspham/byakugan-js","last_synced_at":"2026-04-24T16:33:13.762Z","repository":{"id":38283014,"uuid":"275340949","full_name":"auspham/byakugan-js","owner":"auspham","description":"A simple NPM package implemented A* Pathfinding algorithm for sensory type ninjas.","archived":false,"fork":false,"pushed_at":"2024-01-05T09:12:48.000Z","size":3852,"stargazers_count":3,"open_issues_count":17,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-04T09:19:05.654Z","etag":null,"topics":["astar","astar-algorithm","astar-pathfinding","javascript","naruto","pathfinding","typescript"],"latest_commit_sha":null,"homepage":"http://byakugan.js.org/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auspham.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-06-27T09:37:31.000Z","updated_at":"2022-05-24T13:40:23.000Z","dependencies_parsed_at":"2024-01-16T12:49:52.229Z","dependency_job_id":"e267bd8a-e39d-4e2a-bb07-9ee52b918398","html_url":"https://github.com/auspham/byakugan-js","commit_stats":{"total_commits":82,"total_committers":1,"mean_commits":82.0,"dds":0.0,"last_synced_commit":"8efc76d515a103206cd0b1e23d817974dd91c8eb"},"previous_names":["auspham/byakugan-js","rockmanvnx6/byakugan-js"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/auspham/byakugan-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auspham%2Fbyakugan-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auspham%2Fbyakugan-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auspham%2Fbyakugan-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auspham%2Fbyakugan-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auspham","download_url":"https://codeload.github.com/auspham/byakugan-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auspham%2Fbyakugan-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32230953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astar","astar-algorithm","astar-pathfinding","javascript","naruto","pathfinding","typescript"],"created_at":"2024-10-12T05:49:41.626Z","updated_at":"2026-04-24T16:33:13.748Z","avatar_url":"https://github.com/auspham.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Byakugan-js\n\n[![NPM](https://nodei.co/npm/byakugan-js.png)](https://nodei.co/npm/byakugan-js/)\n\n## Description\n\nByakugan-js is an array-based, super simple and lightweight implementation of [A*](https://en.wikipedia.org/wiki/A*_search_algorithm) pathfinding algorithm written in Typescript. \n\nIt's then compiled into JavaScript with ES 5 syntax.\n\nThe name [Byakugan](https://naruto.fandom.com/wiki/Byakugan) (白眼) was influenced by the manga series [Naruto](https://en.wikipedia.org/wiki/Naruto).\n\n**Demo**: https://byakugan.js.org/ (please visit using either tablet or pc to see the demo).\n\n## Installation:\n\n**Node**: `npm install --save byakugan-js`\n\n**Web**: Use packages inside `build/` or use one of the following CDNs:\n\nMinified build:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/rockmanvnx6/byakugan-js@master/dist/byakugan.min.js\"\u003e\u003c/script\u003e\n```\n\nDevelopment build:\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/rockmanvnx6/byakugan-js@master/dist/byakugan.js\"\u003e\u003c/script\u003e\n```\n\n## Quick start\n\nMake sure `Byakugan-js` is installed via `npm` or included using `CDN`.\n\n```js\nconst Byakugan = require('byakugan-js'); // ignore if using CDN\n\nconst settings = {\n        grid: [\n            [1, 0, 0, 0],\n            [1, 0, 0, 0],\n            [0, 0, 0, 0],\n            [0, 1, 0, 0],\n            [0, 1, 1, 1],\n            [0, 0, 0, 1],\n        ],\n        obstacles: [1,3], // Obstacle tiles\n        diagonal: true, // Move diagonally, default false\n}\nconst byakugan = new Byakugan(settings);\nconst paths = byakugan.search(0,1,3,3);\n```\n\n## Methods:\n\n**search(row1, col1, row2, col2)**\n\n\u003e Return a 2D array which contains the coordinates of path.\n\n*Example:*\n\n```js\nlet byakugan = new Byakugan(settings)\nbyakugan.search(0,1,3,3); // Find path from grid[0][1] to grid[3][3]\n```\n\nReturn:\n```\n[ [1,1], [2,1], [2,2], [3,2], [3,3] ]\n```\n\n## Settings Object\n\nThese are the available keys of the `settings` object\n\n| Key                          | Value                                                        |\n| ---------------------------- | ------------------------------------------------------------ |\n| grid: `Array\u003cArray\u003cNumber\u003e\u003e` | A 2D array describe the grid. **Required**                   |\n| obstacles: `Array`           | Array of obstacles value. `Default = [1]`                    |\n| diagonal: `boolean`          | `true/false` value to determine if the algorithm can go diagonally. `Default = false` |\n| callbacks: `Object`          | An object contain list of callbacks functions.               |\n| heuristics: `Object`         | Select heuristic distance functions for type `normal` and `diagonal`. Use `override` to override the heuristic functions. |\n\n\n\n## Callbacks\n\nThese are the list of available callback functions:\n\n| functions                 | description                                                  |\n| ------------------------- | ------------------------------------------------------------ |\n| `nodeConstructions(node)` | The function will be called after a node is constructed. It will pass a `object` type as the parameter the object will have the following values: `{ row: number, col: number, isObstacle: boolean}` |\n\n## Heuristics\n\nThe available heuristic functions are:\n\n- `Eucludian`\n- `Manhattan` (default for `normal` (4 directions) movement)\n- `Octile` (default for `diagonal` (8 directions) movement)\n\nThe default settings were used based on [this suggestions](http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html). Where for diagonal distance, *Octile* distance was chosen with `D = 1`  and `D2 = sqrt(2)`.\n\n\n\nTo re-select/override a distance function, simply define in the settings object:\n```js\nlet settings = {\n    grid: grid,\n    heuristics: {\n        normal: 'eucludian', // default Manhattan\n        override: {\n        \tdiagonal: function (a,b) {\n                let dx = Math.abs(a.col - b.col);\n                let dy = Math.abs(a.row - b.row);\n                return 0.5 * (dx + dy)\n            }\n    \t}\n    }\n}\n```\n\nThe above configuration will use `eucludian` distance for `normal` movement and a custom function for `diagonal` movement.\n\n\n\n## Development guide:\n\n1. Fork or clone this project.\n2. Run `cd byakugan/ \u0026\u0026 npm install`\n3. Run `npm run dev` to develop\n4. Run `npm run build` to build\n5. Run `npm run test` or `npm run coverage` to test\n\n## Contribution\n\nContributions are very welcome. Simply fork this project and make [pull requests](https://github.com/rockmanvnx6/byakugan/pulls).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauspham%2Fbyakugan-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauspham%2Fbyakugan-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauspham%2Fbyakugan-js/lists"}