{"id":21187036,"url":"https://github.com/thunderstruct/maze-generator","last_synced_at":"2025-03-14T20:19:37.220Z","repository":{"id":143385823,"uuid":"56805871","full_name":"ThunderStruct/Maze-Generator","owner":"ThunderStruct","description":"Maze Generator using a custom version of randomized prim algorithm","archived":false,"fork":false,"pushed_at":"2016-10-27T21:44:28.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T13:07:27.042Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","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/ThunderStruct.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":"2016-04-21T21:10:51.000Z","updated_at":"2019-03-08T13:57:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"76c9d92a-15fe-4f05-b238-7af17a805cbc","html_url":"https://github.com/ThunderStruct/Maze-Generator","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/ThunderStruct%2FMaze-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThunderStruct%2FMaze-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThunderStruct%2FMaze-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThunderStruct%2FMaze-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThunderStruct","download_url":"https://codeload.github.com/ThunderStruct/Maze-Generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243639569,"owners_count":20323516,"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-20T18:28:03.194Z","updated_at":"2025-03-14T20:19:37.192Z","avatar_url":"https://github.com/ThunderStruct.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Maze Generator\nMaze generator class with many complementary methods - written in C++\n## Notes\n* This class uses Randomized Prim's algorithm (only one way from the start point to the end point)\n* The start and end points of the maze are the two furthest points away from each other that can be connected by a *path*\n* The maze is generated and handled as a 2D std::vector of int\n  * *Walls* or obstucles are represented as zeroes\n  * *Paths* are represented as ones\n  * The starting and ending points are represented as two and three, respectively\n* The class was designed and written for the iOS app **Get Out: One Way** with a few more Cocos2D-X methods, which are redacted in this publishing\n* The longest path algorithm used to determine the start and end points is brute-force and has the largest complexity and so creating large mazes might take time (check the Task List below)\n\n## Instructions\n### Sample Maze Generation\n```\nstd::vector\u003cstd::vector\u003cint\u003e\u003e maze = MazeGenerator::getMaze(10);  // generates a random maze in the form of a 2D array of int\nMazeGenerator::printMaze(maze); // Prints the content of the 2D std::vector\n```\n### Sample Output\n```\n00000000000\n01011111110\n01010001010\n01111101010\n01010000010\n01011101020\n01000001000\n01111111110\n01010101000\n01010101130\n00000000000\n```\n\n### Other Methods\n* Get the generated start and end coordinates\n```\nstd::pair\u003cint, int\u003e getStartCoordinates()\nstd::pair\u003cint, int\u003e getEndCoordinates();\n```\n* Get the distance (number of horizontal and vertical moves) from the start to the end\n```\nint getDistance();\n```\n* Get a distance-array; an array containing distances away from the end point (disregards walls!) \n```\nstd::vector\u003cstd::vector\u003cint\u003e\u003e getDistArray(); // starting coordinates in this array would contain getDistance()\n// one tile closer to the end along the path would contain getDistance() - 1\n```\n* Get the path's coordinates\n```\nstd::vector\u003cstd::pair\u003cint, int\u003e\u003e getPathCoordinates();  // from start to end\n```\n## Task List\n- [ ] Upgrade the performance by finding a less expensive longest-path algorithm\n- [ ] Add an option to manually select start and end points\n\n**Feel free to make a pull request or request a feature!**\n\n## Credits\nThe MazeGenerator class is solely designed and written by Mohamed Shahawy\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunderstruct%2Fmaze-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthunderstruct%2Fmaze-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthunderstruct%2Fmaze-generator/lists"}