Tetris for OpenAI Gym
Project description
# gym-![T][]etris
[T]: https://user-images.githubusercontent.com/2184469/41186381-ebd61f8c-6b5a-11e8-98ce-874e29801308.png
[![PackageVersion][pypi-version]][pypi-home]
[![PythonVersion][python-version]][python-home]
[![Stable][pypi-status]][pypi-home]
[![Format][pypi-format]][pypi-home]
[![License][pypi-license]](LICENSE)
[pypi-version]: https://badge.fury.io/py/gym-tetris.svg
[pypi-license]: https://img.shields.io/pypi/l/gym-tetris.svg
[pypi-status]: https://img.shields.io/pypi/status/gym-tetris.svg
[pypi-format]: https://img.shields.io/pypi/format/gym-tetris.svg
[pypi-home]: https://badge.fury.io/py/gym-tetris
[python-version]: https://img.shields.io/pypi/pyversions/gym-tetris.svg
[python-home]: https://python.org
An [OpenAI Gym](https://github.com/openai/gym) environment for Tetris. This
environemnt derives from the [Tetromino clone][Tetromino] developed by Al
Sweigart.
![Tetris](https://user-images.githubusercontent.com/2184469/41186404-826ebba2-6b5b-11e8-8215-eb21d765b0b9.png)
[Tetromino]: http://inventwithpython.com/blog/2010/11/18/code-comments-tutorial-tetromino/
# Installation
The preferred installation of `gym-tetris` is from `pip`:
```shell
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.
```python
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.
```shell
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.
```tex
@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}},
}
```
[T]: https://user-images.githubusercontent.com/2184469/41186381-ebd61f8c-6b5a-11e8-98ce-874e29801308.png
[![PackageVersion][pypi-version]][pypi-home]
[![PythonVersion][python-version]][python-home]
[![Stable][pypi-status]][pypi-home]
[![Format][pypi-format]][pypi-home]
[![License][pypi-license]](LICENSE)
[pypi-version]: https://badge.fury.io/py/gym-tetris.svg
[pypi-license]: https://img.shields.io/pypi/l/gym-tetris.svg
[pypi-status]: https://img.shields.io/pypi/status/gym-tetris.svg
[pypi-format]: https://img.shields.io/pypi/format/gym-tetris.svg
[pypi-home]: https://badge.fury.io/py/gym-tetris
[python-version]: https://img.shields.io/pypi/pyversions/gym-tetris.svg
[python-home]: https://python.org
An [OpenAI Gym](https://github.com/openai/gym) environment for Tetris. This
environemnt derives from the [Tetromino clone][Tetromino] developed by Al
Sweigart.
![Tetris](https://user-images.githubusercontent.com/2184469/41186404-826ebba2-6b5b-11e8-8215-eb21d765b0b9.png)
[Tetromino]: http://inventwithpython.com/blog/2010/11/18/code-comments-tutorial-tetromino/
# Installation
The preferred installation of `gym-tetris` is from `pip`:
```shell
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.
```python
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.
```shell
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.
```tex
@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
Release history Release notifications | RSS feed
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.0.2.tar.gz
(16.4 kB
view details)
Built Distribution
File details
Details for the file gym_tetris-1.0.2.tar.gz
.
File metadata
- Download URL: gym_tetris-1.0.2.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c90df1f47ac54e351c9344af0b8a4b625a8a6261aad0dc114edda5fe1a9f14ea |
|
MD5 | 6c1630aa2e9693540b7e3bbd97196fd6 |
|
BLAKE2b-256 | fe97923b51a06e1a443d2122d9a7bece2b390ee85dcdab685ee76888a3b730e3 |
File details
Details for the file gym_tetris-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: gym_tetris-1.0.2-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b5f7afe1c92e4ef44ab047125808a5512243d82e9ef0b3f1932094f931e2878 |
|
MD5 | da9d219c87a51138ade635d014d46793 |
|
BLAKE2b-256 | 39919e712b677d7d596ba4e478ea29f8bdbe8f4fc82d9090b54d581a90086e41 |