{"id":16377908,"url":"https://github.com/sofianedjerbi/pyboyenv","last_synced_at":"2025-10-26T10:30:42.575Z","repository":{"id":160709615,"uuid":"258911238","full_name":"sofianedjerbi/PyBoyEnv","owner":"sofianedjerbi","description":"Turn any gameboy game into a reinforcement learning environment.","archived":false,"fork":false,"pushed_at":"2023-04-18T21:42:28.000Z","size":10758,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T18:12:17.311Z","etag":null,"topics":["environment","reinforcement-learning","reinforcement-learning-environments"],"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/sofianedjerbi.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}},"created_at":"2020-04-26T01:27:35.000Z","updated_at":"2023-12-11T21:02:38.000Z","dependencies_parsed_at":"2023-05-13T12:30:35.681Z","dependency_job_id":null,"html_url":"https://github.com/sofianedjerbi/PyBoyEnv","commit_stats":null,"previous_names":["chaoxel/pyboyenv","kugge/pyboyenv","sofianedjerbi/pyboyenv"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianedjerbi%2FPyBoyEnv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianedjerbi%2FPyBoyEnv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianedjerbi%2FPyBoyEnv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sofianedjerbi%2FPyBoyEnv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sofianedjerbi","download_url":"https://codeload.github.com/sofianedjerbi/PyBoyEnv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238310171,"owners_count":19450802,"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":["environment","reinforcement-learning","reinforcement-learning-environments"],"created_at":"2024-10-11T03:44:13.085Z","updated_at":"2025-10-26T10:30:42.259Z","avatar_url":"https://github.com/sofianedjerbi.png","language":"Python","readme":"# PyBoyEnv\nThis package allow you to turn any gameboy memory event into a reinforcement learning environment rule.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"demo.gif\"\u003e\u003cbr/\u003e\n    (generated with test.py)\n\u003c/p\u003e\n\n## Installation\nInstall the dependencies:\n\n```bash\npip install -r requirements.txt\n```\n\nInstall the package with `pip`:\n\n```bash\npip install ./\n```\n\n## Quickstart \n```python\nimport gym\nimport pyboyenv\n\n# Create the environment\nenv = gym.make('Pyboy-v0', game=\u003cFILE\u003e)\n\n# Add rules\nenv.set_reward_rule(ADDRESS, TYPE, VALUE, LABEL)\n\n# Available rules:\n# - increase: add VALUE if the memory at the address ADDRESS increases\n# - decrease: add VALUE if the memory at the address ADDRESS decreases\n# - smaller X: add VALUE if the memory at the address ADDRESS is smaller than X\n# - bigger X: add VALUE if the memory at the address ADDRESS is bigger than X\n# - equals X: add VALUE if the memory at the address ADDRESS equals X\n# - in X1,..,XN: add VALUE if the memory at the address ADDRESS is equal to X1 or ... or XN\n\n# Useful values\ncumul = 0 # Sum of rewards \ndone = False # Is the game done ?\naction = 16 # Initial action (action list available below, 16=nothing)\n\n# Game loop\nwhile not done:\n    # State = Window screen\n    state, reward, done, info = env.step(action)\n    cumul += reward\n    action = Agent.get_action(state, cumul, reward) # Next action\n    # Print infos\n    for i in info:\n        print(f\"{i[0]}: {i[1]}\")\n```\n\n## Actions\n- 0: `WindowEvent.PRESS_ARROW_UP`\n- 1: `WindowEvent.PRESS_ARROW_DOWN`\n- 2: `WindowEvent.PRESS_ARROW_LEFT`\n- 3: `WindowEvent.PRESS_ARROW_RIGHT`\n- 4: `WindowEvent.PRESS_BUTTON_A`\n- 5: `WindowEvent.PRESS_BUTTON_B`\n- 6: `WindowEvent.PRESS_BUTTON_SELECT`\n- 7: `WindowEvent.PRESS_BUTTON_START`\n- 8: `WindowEvent.RELEASE_ARROW_UP`\n- 9: `WindowEvent.RELEASE_ARROW_DOWN`\n- 10: `WindowEvent.RELEASE_ARROW_LEFT`\n- 11: `WindowEvent.RELEASE_ARROW_RIGHT`\n- 12: `WindowEvent.RELEASE_BUTTON_A`\n- 13: `WindowEvent.RELEASE_BUTTON_B`\n- 14: `WindowEvent.RELEASE_BUTTON_SELECT`\n- 15: `WindowEvent.RELEASE_BUTTON_START`\n- 16: `WindowEvent.PASS`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofianedjerbi%2Fpyboyenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofianedjerbi%2Fpyboyenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofianedjerbi%2Fpyboyenv/lists"}