{"id":19219161,"url":"https://github.com/ssarcandy/breakout-env","last_synced_at":"2025-08-03T00:15:10.182Z","repository":{"id":62560426,"uuid":"120109841","full_name":"SSARCandy/breakout-env","owner":"SSARCandy","description":"🎮 A configurable Breakout environment for reinforcement learning","archived":false,"fork":false,"pushed_at":"2018-03-20T16:49:30.000Z","size":118,"stargazers_count":11,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-17T16:55:20.842Z","etag":null,"topics":["game","python3","reinforcement-learning"],"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/SSARCandy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-03T16:45:32.000Z","updated_at":"2024-07-23T15:14:55.000Z","dependencies_parsed_at":"2022-11-03T14:30:34.335Z","dependency_job_id":null,"html_url":"https://github.com/SSARCandy/breakout-env","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SSARCandy%2Fbreakout-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SSARCandy%2Fbreakout-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SSARCandy%2Fbreakout-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SSARCandy%2Fbreakout-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SSARCandy","download_url":"https://codeload.github.com/SSARCandy/breakout-env/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249958796,"owners_count":21351716,"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":["game","python3","reinforcement-learning"],"created_at":"2024-11-09T14:29:46.062Z","updated_at":"2025-04-20T20:32:19.465Z","avatar_url":"https://github.com/SSARCandy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Breakout-env\n\nA [gym](https://github.com/openai/gym/blob/master/gym/envs/atari/atari_env.py) like Breakout environment but with more configurable options.\n\n![](https://raw.githubusercontent.com/SSARCandy/breakout-env/master/demo/normal.gif)\n![](https://raw.githubusercontent.com/SSARCandy/breakout-env/master/demo/big-ball.gif)\n![](https://raw.githubusercontent.com/SSARCandy/breakout-env/master/demo/big-paddle.gif)\n![](https://raw.githubusercontent.com/SSARCandy/breakout-env/master/demo/more-bricks.gif)\n\n## Configurable Options\n\n| Option          | Description                     | Type          | Range      | Default Value                    |\n|-----------------|---------------------------------|---------------|------------|----------------------------------|\n| `max_step`      | Max step per episode.           | `int`         | 0 ~ Inf    | `10000`                          |\n| `lifes`         | Lifes per episode.              | `int`         | 0 ~ 9      | `5`                              |\n| `ball_pos`      | Ball's initial position. [y, x] | `[int, int]`  | -Inf ~ Inf | `[100, 40]`                      |\n| `ball_speed`    | Ball's initial velocity. [y, x] | `[int, int]`  | -Inf ~ Inf | `[4, 2]`                         |\n| `ball_color`    | Ball's color. (gray scale)      | `int`         | 0 ~ 255    | `143`                            |\n| `ball_size`     | Ball's size. [h, w]             | `[int, int]`  | 1 ~ Inf    | `[5, 2]`                         |\n| `paddle_width`  | Paddle's width.                 | `int`         | 1 ~ 100    | `15`                             |\n| `paddle_color`  | Paddle's color. (gray scale)    | `int`         | 0 ~ 255    | `143`                            |\n| `paddle_speed`  | Paddle's moving speed.          | `int`         | 1 ~ Inf    | `3`                              |\n| `bricks_rows`   | Number of bricks row.           | `int`         | 0 ~ Inf    | `6`                              |\n| `bricks_color`  | Row color of bricks.\\*          | list of `int` | 0 ~ 255    | `[200, 180, 160, 140, 120, 100]` |\n| `bricks_reward` | The reward of bricks.\\*         | list of `int` | -Inf ~ Inf | `[6, 5, 4, 3, 2, 1]`             |\n\n\\* `len(bricks_color)` and `len(bricks_color)` should equal to `bricks_rows`.\n\n## Installation\n\nInstall from PyPI:\n\n```sh\n$ pip install breakout_env\n```\n\nInstall from master branch\n\n```sh\n$ pip install git+https://github.com/SSARCandy/breakout-env.git@master\n```\n\n## Example\n\n### Interact with environment\n\n```py\nfrom breakout_env import Breakout\n\n# Create Breakout environment with some options.\nenv = Breakout({\n    'lifes': 7,\n    'paddle_width': 30,\n    'paddle_speed': 5\n  })\n\nfor ep in range(2):\n  obs = env.reset()\n  while True:\n    # Select random action\n    action = random.randint(0, env.actions - 1)\n    obs, reward, done, _ = env.step(action)\n    print('Episode: {}, Reward: {}, Done: {}'.format(ep, reward, done))\n    if done:\n      break\n```\n\n### Visualize the game\n\nThe observation retuned by env is a numpy 2D array, it can be easily visualize using some library like [OpenCV](https://opencv.org/) or [matplotlib](https://matplotlib.org/).\n\n```py\nimport cv2\nfrom breakout_env import Breakout\n\nenv = Breakout()\nenv.reset()\n\nwhile True:\n  # Select random action\n  action = random.randint(0, env.actions - 1)\n  obs, _, _, _ = env.step(action)\n  # Show the observation using OpenCV\n  cv2.imshow('obs', obs)\n  cv2.waitKey(1)\n  if done:\n    break\n```\n\n## Develop Requirement\n\n- python3\n- numpy\n\n## Reference\n\n- [OpenAI Gym](https://github.com/openai/gym/blob/master/gym/envs/atari/atari_env.py)\n- [ALE interface - Breakout](https://github.com/openai/atari-py/blob/master/atari_py/ale_interface/src/games/supported/Breakout.cpp)\n- [BreakoutNoFrameskip-v4 video](https://youtu.be/o72FS5eqPNs)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssarcandy%2Fbreakout-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fssarcandy%2Fbreakout-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fssarcandy%2Fbreakout-env/lists"}