{"id":19111077,"url":"https://github.com/ebronnikov/maze","last_synced_at":"2026-06-20T22:31:00.433Z","repository":{"id":109449494,"uuid":"397292111","full_name":"endygamedev/maze","owner":"endygamedev","description":":bricks: Maze solver or pathfinding algorithm.","archived":false,"fork":false,"pushed_at":"2021-08-20T16:01:34.000Z","size":28420,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-03T04:27:48.020Z","etag":null,"topics":["astar-algorithm","astar-pathfinding","maze","maze-generator","maze-solver","pathfinding"],"latest_commit_sha":null,"homepage":"","language":"Python","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/endygamedev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-17T14:45:03.000Z","updated_at":"2023-04-10T09:18:43.000Z","dependencies_parsed_at":"2023-04-04T18:32:24.538Z","dependency_job_id":null,"html_url":"https://github.com/endygamedev/maze","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/endygamedev%2Fmaze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endygamedev%2Fmaze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endygamedev%2Fmaze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/endygamedev%2Fmaze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/endygamedev","download_url":"https://codeload.github.com/endygamedev/maze/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240165251,"owners_count":19758343,"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","maze","maze-generator","maze-solver","pathfinding"],"created_at":"2024-11-09T04:27:01.039Z","updated_at":"2026-05-31T19:30:17.045Z","avatar_url":"https://github.com/endygamedev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"/assets/logo.gif\" alt=\"logo\" width=\"150\"\u003e\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eMaze solver or pathfinding algorithm\u003c/h1\u003e\n\u003cp align=\"center\"\u003eThis repository contains the implementation and visualization of the primitive pathfinding algorithm.\u003c/p\u003e\n\n\u003ch2\u003eProblem\u003c/h2\u003e\n\u003cp\u003eGiven a space with passages and walls, an entry point and an exit point are also given, you must find a path from start to finish through free cells.\u003c/p\u003e\n\u003cp\u003eWe can divide this task into 3 subtasks:\n  \u003col\u003e\n    \u003cli\u003eGenerate given space (maze)\u003c/li\u003e\n    \u003cli\u003eImplement a pathfinding algorithm\u003c/li\u003e\n    \u003cli\u003eCreate visualization of this algorithm\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"/assets/maze_example.png\" alt=\"maze_example\"\u003e\u003cbr\u003e\n  \u003ci\u003e(1) Maze example\u003c/i\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\u003ci\u003eDescription to image (1)\u003c/i\u003e\u003cbr\u003e\n\u003cul\u003e\n  \u003cli\u003e⬛ black — walls\u003c/li\u003e\n  \u003cli\u003e⬜ white — passages\u003c/li\u003e\n  \u003cli\u003e🟩 green — entry point (start)\u003c/li\u003e\n  \u003cli\u003e🟪 magenta — exit point (finish)\u003c/li\u003e\n  \u003cli\u003e🟥 red — iterations (steps)\u003c/li\u003e\n  \u003cli\u003e🟦 cyan — path\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/p\u003e\n\n\u003ch2\u003eAlgorithms\u003c/h2\u003e\n\u003ch3\u003e1. Generate maze\u003c/h3\u003e\n\u003cp\u003eGiven the \u003ccode\u003e\u003ci\u003ewidth\u003c/i\u003e\u003c/code\u003e and \u003ccode\u003e\u003ci\u003eheight\u003c/i\u003e\u003c/code\u003e of the maze we want to create.\u003cbr\u003e\nSo, to begin with, randomly generate an entry point (\u003ccode\u003e\u003ci\u003estart\u003c/i\u003e\u003c/code\u003e) and an exit point (\u003ccode\u003e\u003ci\u003efinish\u003c/i\u003e\u003c/code\u003e).\u003cbr\u003e\nThen we create a matrix of ones (\u003ccode\u003e\u003ci\u003emaze\u003c/i\u003e\u003c/code\u003e), in the further implementation we will denote 0 as a passage, and 1 as a wall. We set a labyrinth of some walls.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"/assets/matrix.png\" alt=\"matrix_example\"\u003e\u003cbr\u003e\n  \u003ci\u003e(2) Maze matrix initialization\u003c/i\u003e\n\u003c/p\u003e\n\u003cp\u003eSet the matrix element \u003ccode\u003e\u003ci\u003emaze\u003csub\u003estart.x start.y\u003c/sub\u003e\u003c/i\u003e = 0\u003c/code\u003e and also denote by \u003ccode\u003e\u003ci\u003e(current.x, current.y)\u003c/sub\u003e\u003c/i\u003e\u003c/code\u003e the current position in the maze matrix.\u003cbr\u003e\nUntil we reach the finish \u003ccode\u003e\u003ci\u003e(current.x, current.y) ≠ (finish.x, finish.y)\u003c/i\u003e\u003c/code\u003e, then we take a random cell from the list of passed cells and a random direction of movement: up, down, left, right; we check whether we can go in this direction, if not, then we change the direction of movement until the desired direction is found, we move in the chosen direction.\u003cbr\u003e\nThus, at each iteration, we move in a random direction of a random cell until we find the finish. We destroy the walls. \n\u003c/p\u003e\n\u003ch3\u003e2. Naive pathfinding algorithm\u003c/h3\u003e\n\u003cp\u003eFirst, we create a zero matrix with the size: \u003ccode\u003e\u003ci\u003ewidth × height\u003c/i\u003e\u003c/code\u003e\u003cbr\u003e\nWe put 1 at the starting point, in all positions around 1 we put 2 if there is no wall (we check this by our maze matrix), around 2 we put 3, also if there is no wall, and so on until we reach the finish point and that number, which will stand at the finish point is the minimum length of the path from start to finish.\u003cbr\u003e\nNow it remains to find the path according to the matrix of steps that we received. To do this, you need to reach the finish point, let's say we reached in \u003ccode\u003e\u003ci\u003ek\u003c/i\u003e\u003c/code\u003e steps, you need to find an adjacent cell with a value of \u003ccode\u003e\u003ci\u003ek - 1\u003c/i\u003e\u003c/code\u003e, go there, decrease \u003ccode\u003e\u003ci\u003ek\u003c/i\u003e\u003c/code\u003e by 1 and repeat this until we get to the starting point, namely 1.\u003c/p\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/summary\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cimg src=\"/assets/maze_matrix.png\" alt=\"maze_matrix_example\"\u003e\u003cbr\u003e\n    \u003ci\u003e(3) Maze (10×10)\u003c/i\u003e\n  \u003c/p\u003e\n  \u003cp\u003eMaze matrix on the example of an image (3)\u003c/p\u003e\n\u003cpre\u003e\n[\n  [0, 0, 0, 0, 0,  0,  0,  0, 0, 0],\n  [0, 0, 0, 0, 0, 10,  0,  0, 0, 0],\n  [0, 0, 0, 0, 8,  9, 10,  0, 0, 0],\n  [0, 0, 0, 0, 7,  0,  0,  0, 0, 0],\n  [0, 0, 0, 7, 6,  0,  0,  0, 0, 0],\n  [0, 0, 0, 6, 5,  4,  0,  0, 0, 0],\n  [0, 0, 6, 5, 4,  3,  4,  0, 0, 0],\n  [0, 6, 5, 0, 3,  2,  0,  0, 0, 0],\n  [0, 5, 4, 3, 2,  1,  0,  0, 0, 0],\n  [0, 0, 0, 0, 0,  0,  0,  0, 0, 0]\n]\u003c/pre\u003e\n\u003c/details\u003e\n\n\u003ch2\u003eExample\u003c/h2\u003e\n\n\u003cp\u003e\u003cb\u003eCode\u003c/b\u003e\u003c/p\u003e\n\n```python\nApp(className=\"Maze\", width=50, height=30, zoom=6)\n```\n\n\u003cp\u003e\u003cb\u003eResult\u003c/b\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"/assets/example.gif\" alt=\"example\"\u003e\u003cbr\u003e\n  \u003ci\u003e(4) Example of the program\u003c/i\u003e\n\u003c/p\u003e\n\n\u003ch2\u003eDependencies\u003c/h2\u003e\n\u003cp\u003eAll dependencies are listed in the file \u003ca href=\"/requirements.txt\"\u003erequirements.txt\u003c/a\u003e.\u003c/p\u003e\n\n\u003ch2\u003eLicense\u003c/h2\u003e\n\u003cp\u003e\u003ccode\u003emaze\u003c/code\u003e is licensed under the \u003ca href=\"/LICENSE\"\u003eMIT License\u003c/a\u003e.\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febronnikov%2Fmaze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Febronnikov%2Fmaze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Febronnikov%2Fmaze/lists"}