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 Distribution

gym_tetris-1.2.4.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file gym_tetris-1.2.4.tar.gz.

File metadata

  • Download URL: gym_tetris-1.2.4.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gym_tetris-1.2.4.tar.gz
Algorithm Hash digest
SHA256 771efa4a334cb277c07a971151cb3caebc51eba50c68aa72ecc0e7d495a80574
MD5 c8e9f3ae5e9051cd4c2d29ad4f18c888
BLAKE2b-256 221f4bf7fae5070722ff87bb7ae908d7507910aa5f99901414c18296ccc7bbe8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gym_tetris-1.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e11703d6212a31e7fe6fa5380856a43d309959bc1ff889efb27760f1e0287d9a
MD5 d448e01dec8e0a65e6928f28192ea05d
BLAKE2b-256 df535885f1a8776da37b944d7884b2032efd14db7ef5fc8ebac9d31a5a674f2a

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