{"id":20949633,"url":"https://github.com/tckerr/pathfinder","last_synced_at":"2025-12-28T01:30:52.557Z","repository":{"id":147009239,"uuid":"49472340","full_name":"tckerr/Pathfinder","owner":"tckerr","description":"Pathfinder is a Javascript library that provides basic 2D pathfinding functionality. The algorithm is a simple implementation of the A-star search algorithm.","archived":false,"fork":false,"pushed_at":"2016-01-12T03:44:35.000Z","size":113,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T22:36:08.820Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tckerr.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-12T03:29:06.000Z","updated_at":"2024-10-05T19:18:56.000Z","dependencies_parsed_at":"2023-04-18T03:33:44.498Z","dependency_job_id":null,"html_url":"https://github.com/tckerr/Pathfinder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tckerr%2FPathfinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tckerr%2FPathfinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tckerr%2FPathfinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tckerr%2FPathfinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tckerr","download_url":"https://codeload.github.com/tckerr/Pathfinder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243345615,"owners_count":20275872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-19T00:41:16.772Z","updated_at":"2025-12-28T01:30:52.528Z","avatar_url":"https://github.com/tckerr.png","language":"JavaScript","readme":"\nDescription\n---\nPathfinder is a Javascript library that provides basic 2D pathfinding functionality. The algorithm is a simple implementation of the [A-star search algorithm](https://en.wikipedia.org/wiki/A*_search_algorithm).\n\n\nInstructions\n---\n\nDownload and include the library:\n```\n\u003cscript src=\"lib/pathfinder.min.js\"\u003e\u003c/script\u003e\n```\n\nYou will then be able to access the library through the ```Pathfinder``` object.\n\nPathfinder has a single function that calculates a path between two points: ```Pathfinder.findPath(nodes, start_node, end_node)```. The arguments are as follows:\n\n- ```nodes```: a 2D array of ```node``` objects (defined below.)\n- ```start_node```: the starting ```node``` object from the ```nodes``` array. This node will **not** count as a step in the pathfinding sequence.\n- ```end_node```: the destination```node``` object from the ```nodes``` array. Arriving at this node will complete the sequence.\n\nTo construct new nodes, use the following syntax: ```var node = new Pathfinder.node(column, row, is_open)```, where the arguments are as follows:\n\n- ```column```: an index starting at 0, representing the nodes horizontal position in the grid.\n- ```row```: an index starting at 0, representing the nodes vertical position in the grid.\n- ```is_open```: a boolean representing whether the node is passable or not.\n\nExample\n---\n\nHere is an example block of code that will construct a node array:\n\n```\nfunction buildNodes(){\n    var nodeColumns = [];\n    var columnCount = 50;\n    var rowCount = 50;\n    for ( var col = 0; col \u003c columnCount; ++col ){\n        nodeColumns.push([]);\n        for ( var row = 0; row \u003c rowCount; ++row ){\n            var node = new Pathfinder.node(col, row, true, false);\n            nodeColumns[col].push(node);                \n        }\n    }\n    return nodeColumns;\n}\n```\n\nFrom here, you could pathfind with the following:\n```\n//pathfind from the top left to the bottom right of our grid\nvar endCol = self.nodeColumns.length - 1;\nvar endRow = self.nodeColumns[endCol].length - 1;\nvar lastResult = window.Pathfinder.findPath(self.nodeColumns, self.nodeColumns[0][0], self.nodeColumns[endCol][endRow] );\n```\n\nNote that the ```findPath``` function will return a list of nodes that represent steps in the pathfinding sequence. It will return ```false``` if no path is possible.\n\nSee the example for an implementation demonstration.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftckerr%2Fpathfinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftckerr%2Fpathfinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftckerr%2Fpathfinder/lists"}