Skip to main content

Tetris for OpenAI Gym

Project description

gym-Tetris

PackageVersion PythonVersion Stable Format License

An OpenAI Gym environment for Tetris. This environemnt derives from the Tetromino clone developed by Al Sweigart.

Tetris

Installation

The preferred installation of gym-tetris is from pip:

pip install gym-tetris

Usage

Python

You must import gym_tetris before trying to make an environment. This is because gym environments are registered at runtime.

import gym_tetris
env = gym_tetris.make('Tetris-v0')

done = True
for step in range(5000):
    if done:
        state = env.reset()
    state, reward, done, info = env.step(env.action_space.sample())

env.close()

NOTE: gym_tetris.make is just an alias to gym.make for convenience.

Command Line

gym_tetris feature a command line interface for playing environments using either the keyboard, or uniform random movement.

gym_tetris -e <the environment ID to play> -m <`human` or `random`>

NOTE: by default, -e is set to Tetris-v0 and -m is set to human.

Citation

Please cite gym-tetris if you use it in your research.

@misc{gym-tetris,
  author = {Albert Sweigart and Christian Kauten},
  title = {{Tetris} for {OpenAI Gym}},
  year = {2018},
  publisher = {GitHub},
  howpublished = {\url{https://github.com/Kautenja/gym-tetris}},
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

gym_tetris-1.2.3-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file gym_tetris-1.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for gym_tetris-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5669fd55ed56b870407fa4ba8f19e9d000fdb7a7bb2559b3e46f53a1e68ba58c
MD5 a5a14a8bf2cff4f88a71c7b93d7d574e
BLAKE2b-256 b692e2c9f4cf925b1399ad704c94a7d37fe8f03a91a1489844c938e7f22cc0dd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page