{"id":31939340,"url":"https://github.com/aig-upf/gridenvs","last_synced_at":"2025-10-14T08:26:01.574Z","repository":{"id":111528051,"uuid":"152611257","full_name":"aig-upf/gridenvs","owner":"aig-upf","description":"Create new gridworld gym environments easily","archived":false,"fork":false,"pushed_at":"2020-07-02T08:34:37.000Z","size":201,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-01-27T23:36:12.894Z","etag":null,"topics":["gridworld","gym-environments","planning-environments","rl-environments"],"latest_commit_sha":null,"homepage":"","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/aig-upf.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":"2018-10-11T15:07:33.000Z","updated_at":"2022-04-21T03:06:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"1417b872-29b2-4af3-8cc4-2c18a5b1a8a1","html_url":"https://github.com/aig-upf/gridenvs","commit_stats":{"total_commits":130,"total_committers":3,"mean_commits":"43.333333333333336","dds":"0.34615384615384615","last_synced_commit":"cb2960e8d5372a8b75e923ed84b6682dd61a7547"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aig-upf/gridenvs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fgridenvs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fgridenvs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fgridenvs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fgridenvs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aig-upf","download_url":"https://codeload.github.com/aig-upf/gridenvs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aig-upf%2Fgridenvs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018311,"owners_count":26086342,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["gridworld","gym-environments","planning-environments","rl-environments"],"created_at":"2025-10-14T08:25:51.394Z","updated_at":"2025-10-14T08:26:01.567Z","avatar_url":"https://github.com/aig-upf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gridenvs\n\nGridenvs is an open-source library that allows to easily create [gym](https://github.com/openai/gym) gridworld environments. To test some [examples](gridenvs/examples), run `keyboard_agent.py`.\n\n## Creating your own environments\n\nYou can easily create an environment by implementing the following three functions:\n* get_init_state(): returns a dictionary containing the internal state of the environment. The state dict will contain all the necessary information of the game, and has to come with at least two elements: \"world\" (the GridWorld object) and \"hero\" (the agent GridObject). \n* get_next_state(state, action): implements the logic of the environment, and returns a tuple `(state, reward, end_of_episode, info)` just as gym's env.step() function, except for the observation, that is automatically generated from the returned state.\n* get_gridstate(state): returns a tuple consisting of the grid size and a list of objects to be rendered. This is used to generate the observation from the state.\n\nMost environments consist of a single agent that moves in a grid (i.e. action affect a single object). If this is your case, consider inheriting from the [HeroEnv](gridenvs/hero.py) class.\nTo easily create a grid map, we provide a function that takes as input a list of strings, such as:\n    \n    [\"WWWWWWWWWW\",\n     \"WD.W....KW\",\n     \"W..W.....W\",\n     \"W..W..WWWW\",\n     \"W........W\",\n     \"W........W\",\n     \"W..WWWW..W\",\n     \"W........W\",\n     \"WH.......W\",\n     \"WWWWWWWWWW\"]\n      \nSee, for instance, the [key-door examples](gridenvs/examples/key_door.py).\n\nTo be able to create your environment with gym.make() you will need to register it. See gym's [creating environments guide](https://github.com/openai/gym/blob/master/docs/creating-environments.md) or check `examples/__init__.py`.\n\nFor other types of games, consider deriving directly from the [Env](gridenvs/env.py) class.\n\n## Installation\n\nClone the repository:\n\n    git clone https://github.com/aig-upf/gridenvs.git\n    cd gridenvs \n    \n(Optional) If you want to create a virtual environment, you can do it by:\n\n    python3 -m venv my_venv\n    source my_venv/bin/activate\n\nInstall gridenvs:\n\n    pip3 install -r requirements.txt\n    \nWhen using it in other projects, make sure gridenvs is in your `$PYTHONPATH` (e.g. by adding it with `export PYTHONPATH=\\my\\path\\to\\gridenvs`).\n\nIf you are using an environment from the examples package, import it so that environments get registered to gym (i.e. `import gridenvs.examples`).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faig-upf%2Fgridenvs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faig-upf%2Fgridenvs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faig-upf%2Fgridenvs/lists"}