Metadata-Version: 2.5
Name: netris
Version: 0.1.0
Summary: Gymnasium environment for Game Boy Tetris emulated with PyBoy
Project-URL: Homepage, https://github.com/javi-aranda/netris
Author: Javier Aranda
License: MIT License
        
        Copyright (c) 2026 Javier Aranda
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: gameboy,gymnasium,pyboy,reinforcement-learning,tetris
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: gymnasium>=1.0
Requires-Dist: numpy>=1.23
Requires-Dist: pyboy>=2.6
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# netris

A [Gymnasium](https://gymnasium.farama.org/) environment for **Game Boy Tetris**,
emulated with [PyBoy](https://github.com/Baekalfen/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

```bash
pip install netris
```

## ROM

The Game Boy Tetris ROM is **not** distributed with this package. Provide your
own dump:

```bash
export NETRIS_ROM=/path/to/tetris.gb
```

## Quickstart

```python
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:

```python
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.
