{"id":25904029,"url":"https://github.com/shanghuiyang/astar","last_synced_at":"2026-05-10T11:56:01.122Z","repository":{"id":57623717,"uuid":"302089846","full_name":"shanghuiyang/astar","owner":"shanghuiyang","description":"A-star algorithm implemented with Go.","archived":false,"fork":false,"pushed_at":"2021-12-31T04:59:52.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-07-27T22:36:55.112Z","etag":null,"topics":["astar-algorithm","astar-pathfinding"],"latest_commit_sha":null,"homepage":"","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/shanghuiyang.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}},"created_at":"2020-10-07T16:06:42.000Z","updated_at":"2021-12-31T04:59:55.000Z","dependencies_parsed_at":"2022-08-30T11:41:23.369Z","dependency_job_id":null,"html_url":"https://github.com/shanghuiyang/astar","commit_stats":null,"previous_names":["shanghuiyang/a-star"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shanghuiyang%2Fastar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shanghuiyang%2Fastar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shanghuiyang%2Fastar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shanghuiyang%2Fastar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shanghuiyang","download_url":"https://codeload.github.com/shanghuiyang/astar/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241605808,"owners_count":19989612,"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":["astar-algorithm","astar-pathfinding"],"created_at":"2025-03-03T04:16:55.209Z","updated_at":"2026-05-10T11:55:56.101Z","avatar_url":"https://github.com/shanghuiyang.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"a-star.gif\" width=20% height=20% /\u003e\n\n# A-Star\n[![CI](https://github.com/shanghuiyang/astar/actions/workflows/ci.yml/badge.svg)](https://github.com/shanghuiyang/astar/actions/workflows/ci.yml)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/shanghuiyang/astar/blob/master/LICENSE)\n\nA-Star algorithm implemented with Go.\n\n## Usage\nsee the [example/main.go](example/main.go) for complete usage.\n```go\npackage main\n\nimport (\n    \"fmt\"\n\n    \"github.com/shanghuiyang/astar\"\n    \"github.com/shanghuiyang/astar/tilemap\"\n)\n\n// a map with 10 rows and 20 cols\nconst strmap = `\n####################\n#                  #\n#                  #\n#   #########      #\n#                  #\n#        #######   #\n#                  #\n#                  #\n#                  #\n####################\n`\n\nfunc main() {\n    // build a map from string\n    m := tilemap.BuildFromStr(strmap)\n\n    // define the origin and destination\n    org := \u0026astar.Point{X: 7, Y: 2}\n    des := \u0026astar.Point{X: 1, Y: 16}\n\n    // find the path using a-star algorithm\n    a := astar.New(m)\n    path, err := a.FindPath(org, des)\n    if err != nil {\n        fmt.Printf(\"error: %v\\n\", err)\n        return\n    }\n\n    // draw the tilemap with the path\n    a.Draw()\n    fmt.Printf(\"path: %v\\n\\n\", path)\n}\n```\n\noutput,\n```\n####################\n#              .B  #\n#             .    #\n#   #########.     #\n#    ........      #\n#   .    #######   #\n#  .               #\n# A                #\n#                  #\n####################\npath: (7, 2) (6, 3) (5, 4) (4, 5) (4, 6) (4, 7) (4, 8) (4, 9) (4, 10) (4, 11) (4, 12) (3, 13) (2, 14) (1, 15) (1, 16)\n```\n\n## More Cases\n```\n################        ################\n#              #        #              #\n# A            #        # A            #\n#     ##       #        #  .  ##       #\n#              #        #   .          #\n#            B #        #    ........B #\n################        ################\n\n----------------------------------------\n\n################        ################\n#              #        #              #\n# A            #        # A....        #\n####### ########        #######.########\n#              #        #       .      #\n#            B #        #        ....B #\n################        ################\n\n----------------------------------------\n\n################        ################\n#              #        #     ..       #\n# A    #       #        # A  . #.      #\n#      #       #        #  ..  # .     #\n#      #       #        #      #  .    #\n#      #     B #        #      #   ..B #\n################        ################\n\n----------------------------------------\n\n################\n#       #      #\n# A     #      #\n#       #      #            no way!\n#       #      #\n#       #    B #\n################\n\n----------------------------------------\n\n################\n#              #\n# A            #\n#              #            no way!\n#          #####\n#          # B #\n################ \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshanghuiyang%2Fastar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshanghuiyang%2Fastar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshanghuiyang%2Fastar/lists"}