{"id":20162640,"url":"https://github.com/codeamt/maze_rl","last_synced_at":"2025-06-23T14:36:40.776Z","repository":{"id":201923644,"uuid":"328046491","full_name":"codeamt/maze_rl","owner":"codeamt","description":"a multi-agent cooperative maze game using gym.","archived":false,"fork":false,"pushed_at":"2021-01-09T06:04:21.000Z","size":153,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-03T02:45:27.184Z","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/codeamt.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}},"created_at":"2021-01-09T00:58:33.000Z","updated_at":"2024-04-20T10:57:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"facbc542-273b-45c7-95b0-d3bdf60ebfb7","html_url":"https://github.com/codeamt/maze_rl","commit_stats":null,"previous_names":["codeamt/maze_rl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codeamt/maze_rl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fmaze_rl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fmaze_rl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fmaze_rl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fmaze_rl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeamt","download_url":"https://codeload.github.com/codeamt/maze_rl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeamt%2Fmaze_rl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261495423,"owners_count":23167314,"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-14T00:26:05.753Z","updated_at":"2025-06-23T14:36:40.729Z","avatar_url":"https://github.com/codeamt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# maze_rl\n\u003cp align=\"center\"\u003e\nA multi-agent cooperative maze game using Open AI's gym.\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/Ising_model_5x5_0.svg/2000px-Ising_model_5x5_0.svg.png\" width=30%\u003e\n\u003c/p\u003e\n\n## About\nThis reinforcement learning (RL) game uses Proximal Policy Optimization (PPO2) to train two agents to cooperate in figuring there way out of a n*m (5x5) grid world (the \"Maze\"). \n\n**Rules:**\u003cbr\u003e\n- Agents must stay within bounds  of the nxm Maze \n- Agents cannot occupy the same position simultaneously \n\n**Entities:**\u003cbr\u003e\n- 0: Available Space\n- 1: Agent 1 \n- 2: Agent 2 \n- 3: A Trap (Instant Loss)\n- 4: A Teleportation Portal (Moves partner 3 steps North)\n- 5: An Exit (A win) \n\n**Action Space (Discrete):** \u003cbr\u003e\n- 0: Up\n- 1: Right\n- 2: Down \n- 3: Left \n\n**Observation Space:**\n- (np.array) -\u003e next player and maze world, flattened, concatenated on horizontal axis.\n\n**State:**\n- P: In Play \n- L: Agents Lost \n- W: Agents Won \n\n**Reward Function/Incentive Mechanism:**\n- Reward Range: (-200, 200) \n- Incentives: +1 for Exploring \n- Penalties: -2 for moving to a previopusly visited cell\n\n## Getting started\nClone the repo:\n```\nhttps://github.com/codeamt/maze_rl.git\n```\n\nInstall depemndencies:\n```\ncd maze_rl \u0026\u0026 pip install -r requirements.txt\n```\n\n## Running Episodes (Local)\nChange into src directory and run script:\n```\ncd code \u0026\u0026 python main.py\n```\n### Args: \n\n- **--epochs** \u003cbr\u003e\n(type: int, default: 500000)\u003cbr\u003e\nNumber of epochs\n\n- **--lr** \u003cbr\u003e\n(type: float, default: 0.001)\u003cbr\u003e\nLearning rate for training policy\n\n- **--gamma** \u003cbr\u003e\n(type: float, default: 0.000001)\u003cbr\u003e\nDiscount Factor \n\n- **--lam** \u003cbr\u003e\n(type; float, default: 0)\u003cbr\u003e\nLambda/GAE Factor\n\n- **--world** (type: List[List[int],\u003cbr\u003e \ndefault:\u003cbr\u003e \n[[1, 0, 2, 0, 0],\u003cbr\u003e\n[0, 0, 0, 0, 0],\u003cbr\u003e \n[4, 0, 0, 0, 0],\u003cbr\u003e\n[0, 0, 3, 3, 0],\u003cbr\u003e\n[0, 0, 3, 5, 0]]\n\n- **--inference** (type: bool, default: True)\nWhether or not to run a quick inference test after training to test performance. \n\n\nAfter some warnings from Tensorflow, you will see the updated maze after each steps on the output.\nCheck the render folder for a training report.\n\n\n## Docker Build/Run Instructions\nBuild the image:\n```\ndocker build -t \u003cchoose img name\u003e .\n```\nRun the container: \n```\ndocker run -d -it --name=\u003cname of this container\u003e \u003cchoosen img name\u003e python main.py --epochs=500000 \n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeamt%2Fmaze_rl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeamt%2Fmaze_rl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeamt%2Fmaze_rl/lists"}