{"id":13412925,"url":"https://github.com/beefsack/go-astar","last_synced_at":"2025-09-16T21:04:50.423Z","repository":{"id":17467773,"uuid":"20241916","full_name":"beefsack/go-astar","owner":"beefsack","description":"Go implementation of the A* search algorithm","archived":false,"fork":false,"pushed_at":"2022-01-27T15:08:37.000Z","size":19,"stargazers_count":619,"open_issues_count":3,"forks_count":81,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-08-13T20:17:04.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/beefsack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"beefsack"}},"created_at":"2014-05-28T02:00:03.000Z","updated_at":"2025-08-02T15:36:48.000Z","dependencies_parsed_at":"2022-07-16T03:00:33.655Z","dependency_job_id":null,"html_url":"https://github.com/beefsack/go-astar","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beefsack/go-astar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefsack%2Fgo-astar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefsack%2Fgo-astar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefsack%2Fgo-astar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefsack%2Fgo-astar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beefsack","download_url":"https://codeload.github.com/beefsack/go-astar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beefsack%2Fgo-astar/sbom","scorecard":{"id":230124,"data":{"date":"2025-08-11","repo":{"name":"github.com/beefsack/go-astar","commit":"4ecf9e3044829f1e2d9eba4ff26295a2bbb9b2cd"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/17 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T04:42:11.227Z","repository_id":17467773,"created_at":"2025-08-17T04:42:11.228Z","updated_at":"2025-08-17T04:42:11.228Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275483877,"owners_count":25473144,"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","status":"online","status_checked_at":"2025-09-16T02:00:10.229Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-07-30T20:01:31.174Z","updated_at":"2025-09-16T21:04:50.339Z","avatar_url":"https://github.com/beefsack.png","language":"Go","funding_links":["https://github.com/sponsors/beefsack"],"categories":["Game Development","游戏开发","Relational Databases","\u003cspan id=\"游戏开发-game-development\"\u003e游戏开发 Game Development\u003c/span\u003e","Go"],"sub_categories":["Advanced Console UIs","Search and Analytic Databases","检索及分析资料库","SQL 查询语句构建库","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e"],"readme":"go-astar\n========\n\n**A\\* pathfinding implementation for Go**\n\n[![Build Status](https://travis-ci.org/beefsack/go-astar.svg?branch=master)](https://travis-ci.org/beefsack/go-astar)\n\nThe [A\\* pathfinding algorithm](http://en.wikipedia.org/wiki/A*_search_algorithm) is a pathfinding algorithm noted for its performance and accuracy and is commonly used in game development.  It can be used to find short paths for any weighted graph.\n\nA fantastic overview of A\\* can be found at [Amit Patel's Stanford website](http://theory.stanford.edu/~amitp/GameProgramming/AStarComparison.html).\n\nExamples\n--------\n\nThe following crude examples were taken directly from the automated tests.  Please see `path_test.go` for more examples.\n\n### Key\n\n*   `.` - Plain (movement cost 1)\n*   `~` - River (movement cost 2)\n*   `M` - Mountain (movement cost 3)\n*   `X` - Blocker, unable to move through\n*   `F` - From / start position\n*   `T` - To / goal position\n*   `●` - Calculated path\n\n### Straight line\n\n```\n.....~......      .....~......\n.....MM.....      .....MM.....\n.F........T.  -\u003e  .●●●●●●●●●●.\n....MMM.....      ....MMM.....\n............      ............\n```\n\n### Around a mountain\n\n```\n.....~......      .....~......\n.....MM.....      .....MM.....\n.F..MMMM..T.  -\u003e  .●●●MMMM●●●.\n....MMM.....      ...●MMM●●...\n............      ...●●●●●....\n```\n\n### Blocked path\n\n```\n............      \n.........XXX\n.F.......XTX  -\u003e  No path\n.........XXX\n............\n```\n\n### Maze\n\n```\nFX.X........      ●X.X●●●●●●..\n.X...XXXX.X.      ●X●●●XXXX●X.\n.X.X.X....X.  -\u003e  ●X●X.X●●●●X.\n...X.X.XXXXX      ●●●X.X●XXXXX\n.XX..X.....T      .XX..X●●●●●●\n```\n\n### Mountain climber\n\n```\n..F..M......      ..●●●●●●●●●.\n.....MM.....      .....MM...●.\n....MMMM..T.  -\u003e  ....MMMM..●.\n....MMM.....      ....MMM.....\n............      ............\n```\n\n### River swimmer\n\n```\n.....~......      .....~......\n.....~......      ....●●●.....\n.F...X...T..  -\u003e  .●●●●X●●●●..\n.....M......      .....M......\n.....M......      .....M......\n```\n\nUsage\n-----\n\n### Import the package\n\n```go\nimport \"github.com/beefsack/go-astar\"\n```\n\n### Implement Pather interface\n\nAn example implementation is done for the tests in `path_test.go` for the Tile type.\n\nThe `PathNeighbors` method should return a slice of the direct neighbors.\n\nThe `PathNeighborCost` method should calculate an exact movement cost for direct neighbors.\n\nThe `PathEstimatedCost` is a heuristic method for estimating the distance between arbitrary tiles.  The examples in the test files use [Manhattan distance](http://en.wikipedia.org/wiki/Taxicab_geometry) to estimate orthogonal distance between tiles.\n\n```go\ntype Tile struct{}\n\nfunc (t *Tile) PathNeighbors() []astar.Pather {\n\treturn []astar.Pather{\n\t\tt.Up(),\n\t\tt.Right(),\n\t\tt.Down(),\n\t\tt.Left(),\n\t}\n}\n\nfunc (t *Tile) PathNeighborCost(to astar.Pather) float64 {\n\treturn to.MovementCost\n}\n\nfunc (t *Tile) PathEstimatedCost(to astar.Pather) float64 {\n\treturn t.ManhattanDistance(to)\n}\n```\n\n### Call Path function\n\n```go\n// t1 and t2 are *Tile objects from inside the world.\npath, distance, found := astar.Path(t1, t2)\nif !found {\n\tlog.Println(\"Could not find path\")\n}\n// path is a slice of Pather objects which you can cast back to *Tile.\n```\n\nAuthors\n-------\n\nMichael Alexander \u003cbeefsack@gmail.com\u003e\nRobin Ranjit Chauhan \u003crobin@pathwayi.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeefsack%2Fgo-astar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeefsack%2Fgo-astar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeefsack%2Fgo-astar/lists"}