netris
A Gymnasium environment for Game Boy Tetris, emulated with PyBoy.
- Placement-based action space:
rotation (0-3) * 10 + column (0-9)(40 actions). - Dict observation: board, current/next piece, row completion, holes, bumpiness and aggregate height.
- Line clears are confirmed against the game's own on-screen counter, so phantom clears (e.g. at game over) cannot happen.
- Optional 1-piece lookahead information via the on-screen NEXT panel
(
NetrisEnvConfig(include_next_piece=True)).
Install
pip install netris
ROM
The Game Boy Tetris ROM is not distributed with this package. Provide your own dump:
export NETRIS_ROM=/path/to/tetris.gb
Quickstart
import gymnasium as gym
import netris # registers "Netris/GameBoyTetris-v0"
env = gym.make("Netris/GameBoyTetris-v0") # uses NETRIS_ROM
obs, info = env.reset(seed=0)
obs, reward, terminated, truncated, info = env.step(env.action_space.sample())
env.close()
Or directly:
from netris import NetrisEnvConfig, TetrisEnv
env = TetrisEnv("/path/to/tetris.gb", config=NetrisEnvConfig())
obs, info = env.reset()
License
MIT. PyBoy is an LGPL-3.0 dependency; the Tetris ROM is copyrighted and must be supplied by the user.
Metadata
Release files for netris 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| netris-0.1.0.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| netris-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.3 kB
Release files / netris-0.1.0.tar.gz
| Download URL | netris-0.1.0.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8aa6a69560dffceed85a2185d7453efa7172ad4715fed478cfca5af8177ad89f
|
|
BLAKE2b-256 checksum How to use checksums |
20644f32b6d52f30b29585d39728221f042f90922aacf34290bd7faab90f9968
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / netris-0.1.0-py3-none-any.whl
| Download URL | netris-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1f09532d0afdc7c2807556ecbb3e74f851e82e811c589987a6b9210788f90fc
|
|
BLAKE2b-256 checksum How to use checksums |
dd0e2dc3f1920440e30ee443e19a77673801fadadbc4256596a4da9cc4e7fcb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|