Skip to main content

game-room

A collection of PettingZoo environments for a few different games.

Installation

Requires Python 3.14+. Once the first release is published to PyPI, install it with pip:

python -m pip install game-room

Or add it to a uv project with uv add game-room. The first release is being prepared; until it is published, install from this repository with python -m pip install ..

Getting Started

Save the following as play.py, then run python play.py (or uv run python play.py in a uv project) to simulate a three-player Flip 7 game with random legal actions and print the final scores:

from game_room import flip7_v0

env = flip7_v0.env(num_players=3, render_mode="ansi")
env.reset(seed=42)

for agent in env.agent_iter():
    observation, reward, terminated, truncated, info = env.last()
    if terminated or truncated:
        action = None
    else:
        action = env.action_space(agent).sample(observation["action_mask"])
    env.step(action)

print(env.render())
env.close()

Flip 7

game_room.flip7_v0 implements the 94-card game for 3-18 players using PettingZoo's turn-based AEC API. It includes the opening deal, all special cards, chained Flip Threes, deck recycling, and complete games across multiple rounds.

Actions are 0 (Hit), 1 (Stay), and 2 + seat_index (choose the recipient of an action card). Always use the mask: target selection is a separate decision, and the same player can act multiple times in succession. Invalid actions raise ValueError without changing game state.

Rewards are points earned at each round's end, so each player's episode return equals their final score. Winners are reported in info["winners"] at game end; the reward is not a win/loss reward. By default, a game ends after a completed round brings someone to 200 points. Set target_score to change that threshold, or max_rounds to truncate training episodes at a round boundary (default: no limit). Tied leaders share the win. Scores and the last completed round's scores are available in info after the first round.

The environment supports ansi and human text rendering. It has no parallel API because each decision can immediately affect other players.

See rules and observation reference for rule conventions, card IDs, and the public observation layout.

The _v0 suffix identifies version 0 of the environment's rules and interface. It is independent of the package version (0.1.0). Changes that invalidate existing policies or experiment comparisons should introduce a new environment version, such as flip7_v1, rather than silently replacing flip7_v0.

Development

From a checkout, install the package and development tools:

uv sync --group dev

dev is the dependency group defined in pyproject.toml for pytest and Ruff. uv includes this group by default, so uv sync also works; --group dev makes the intent explicit. These tools are not runtime dependencies and are not installed when users install the published package.

uv run pytest
uv run ruff check src tests
uv run ruff format --check src tests

Tests include PettingZoo API and seed checks, controlled special-card scenarios, and full randomized games checking card conservation and cumulative rewards.

See publishing instructions for building and releasing the package. The implementation is distributed under the MIT license.

Metadata

Release files for game-room 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for game-room 0.1.0
File Size Uploaded Provenance Actions
game_room-0.1.0.tar.gz 14.3 kB Without provenance Details for game_room-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for game-room 0.1.0
File Interpreter ABI Platform Actions
game_room-0.1.0-py3-none-any.whl Python 3 none any Details for game_room-0.1.0-py3-none-any.whl

Total release size: 22.9 kB

Release files / game_room-0.1.0.tar.gz

Download URL game_room-0.1.0.tar.gz
Size 14.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c3550325e845631647ab4543a2d78b506fcd13eebdc0c4ec1205a848f5e25e1d
BLAKE2b-256 checksum
How to use checksums
3789920a0ae27cf6a689f103f264a16ce1b8d20d240088c6fbfb0274747a0229
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / game_room-0.1.0-py3-none-any.whl

Download URL game_room-0.1.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e260b77847e1ddbee1c9863f2d73f31f585a147699f7d8d3ffb7526a8464eb11
BLAKE2b-256 checksum
How to use checksums
ed04fe752e47c59c24ed917cd353eb89f2bcbfe3671964fe3bac325197f7b3f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for game-room 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page