{"id":25363803,"url":"https://github.com/dinoperovic/path-following-algorithm-code-challange","last_synced_at":"2025-04-09T04:21:49.591Z","repository":{"id":74644204,"uuid":"174095842","full_name":"dinoperovic/path-following-algorithm-code-challange","owner":"dinoperovic","description":"Path following algorithm in ASCII Map","archived":false,"fork":false,"pushed_at":"2019-03-06T16:27:32.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T11:02:16.178Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/dinoperovic.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-06T07:38:45.000Z","updated_at":"2023-03-02T10:20:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"0720ef66-152d-441b-9250-494aa14f97ae","html_url":"https://github.com/dinoperovic/path-following-algorithm-code-challange","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/dinoperovic%2Fpath-following-algorithm-code-challange","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoperovic%2Fpath-following-algorithm-code-challange/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoperovic%2Fpath-following-algorithm-code-challange/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoperovic%2Fpath-following-algorithm-code-challange/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dinoperovic","download_url":"https://codeload.github.com/dinoperovic/path-following-algorithm-code-challange/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247975777,"owners_count":21026938,"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":"2025-02-14T22:39:10.140Z","updated_at":"2025-04-09T04:21:49.584Z","avatar_url":"https://github.com/dinoperovic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Path following algorithm (Code challange)\n\n[![Travis branch](https://img.shields.io/travis/dinoperovic/path-following-algorithm-code-challange/master.svg)](https://travis-ci.org/dinoperovic/path-following-algorithm-code-challange)\n[![Codecov](https://img.shields.io/codecov/c/github/dinoperovic/path-following-algorithm-code-challange.svg)](http://codecov.io/github/dinoperovic/path-following-algorithm-code-challange)\n\nPath following algorithm in ASCII Map.\n\nThis script requires **Python** `3.4` or higher.\n\n## How to use\n\nScript can be used by either specifying the paths to files, or passing the\ninput directly.\n\n```sh\n$ python follow_path.py examples/map1.txt\nLetters: \"ACB\"\nPath as characters: \"@---A---+|C|+---+|+-B-x\"\n\n$ python follow_path.py examples/map1.txt examples/map2.txt\nLetters: \"ACB\"\nPath as characters: \"@---A---+|C|+---+|+-B-x\"\nLetters: \"ABCD\"\nPath as characters: \"@|A+---B--+|+----C|-||+---D--+|x\"\n\n$ cat examples/map3.txt | python follow_path.py\nLetters: \"BEEFCAKE\"\nPath as characters: \"@---+B||E--+|E|+--F--+|C|||A--|-----K|||+--E--Ex\"\n```\n\n### Usage from Python\n\nTo use from Python you can use the `FollowPath` class or a shorthand function\n`follow_path` that returns values in `(letters, characters)` tuple format.\n\n```python\nfrom follow_path import FollowPath, follow_path\n\nMAP = \"\"\"\n  @---+\n      B\nK-----|--A\n|     |  |\n|  +--E  |\n|  |     |\n+--E--Ex C\n   |     |\n   +--F--+\n\"\"\"\n\npath = FollowPath(MAP)\npath.run()\nprint(path.letters)\nprint(path.characters)\n\n# Shorthand version\npath = follow_path(MAP)\nprint(path[0])\nprint(path[1])\n```\n\nBoth will output:\n\n```sh\n\"BEEFCAKE\"\n\"@---+B||E--+|E|+--F--+|C|||A--|-----K|||+--E--Ex\"\n```\n\n#### Base logic explained\n\nThis script takes an ASCII map input formated like so:\n```\n@\n| C----+\nA |    |\n+---B--+\n  |      x\n  |      |\n  +---D--+\n```\n\nStarting at `@` symbol, it follows the path while extracting uppercase letters\nas well as storing all the characters on the way. `x` symbol designates the end\nof path, while `+` sing is recognized as corner indicator. Uppercase letters\ncan also indicate a corner and the same letter crossed more than once\nwon't be saved as part of extracted letters.\n\n### Tests\n\nTests can be run with:\n\n```sh\npython tests.py\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinoperovic%2Fpath-following-algorithm-code-challange","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdinoperovic%2Fpath-following-algorithm-code-challange","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinoperovic%2Fpath-following-algorithm-code-challange/lists"}