Skip to main content

game-room

Tests PyPI Python License: MIT

A collection of PettingZoo environments for a few different games.

Supported games:

Installation

Requires Python 3.14+. Add the package to your project with uv:

uv add game-room

The package is available on PyPI.

Getting Started

Save the following as play.py, then run uv run python play.py 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.3.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.

Monopoly Deal

game_room.monopoly_deal_v0 implements the 106-card game for 2–5 players with private hands, banking, property sets and wildcards, all action cards, player-chosen payments, and Just Say No counter-response chains. It uses the same AEC loop shown above; replace the import and environment construction with:

from game_room import monopoly_deal_v0

env = monopoly_deal_v0.env(num_players=3, render_mode="ansi")

Always sample from the action mask. Playing a card may require several decisions to select a color, group, opponent, payment, or response. Rewards are +1 for the winner and −1 for the other players; intermediate rewards are zero. The first player with three complete sets of different colors on their own turn wins. Episodes truncate after 10,000 decisions by default; set max_steps=None to disable this limit.

See the rules, action and observation reference for the supplied 2008 rules, explicit conventions, physical card IDs, and the hidden-information observation layout.

Catan

game_room.catan_v0 implements the base game for 3–4 players on a randomized 19-hex board. It includes snake-order setup, resource production and shortages, building, harbor trades, negotiated player trades with counteroffers, the robber, all development cards, Longest Road and Largest Army.

from game_room import catan_v0

env = catan_v0.env(num_players=4, render_mode="ansi")

Use the same masked AEC loop shown above. Resource hands and unplayed development card types are private; public board state and hand sizes are observable. A win requires at least 10 points on the player's own turn, awarding +1 to the winner and −1 to opponents. Episodes truncate after 20,000 decisions by default; max_steps=None removes this limit.

The environment uses the rulebook's variable board and combined trade/build phase. See the rules, board geometry and API reference for action IDs, the observation layout, and the sequential trading protocol.

Sell Me a Sasquatch

game_room.sasquatch_v0 implements the supplied 120-card game for 2–6 players. It includes hidden offers, all five Thingamabobs, Nasty thefts and cascading sets, Creature scoring, changing Buyers, and the two-player accept/reverse mode.

from game_room import sasquatch_v0

env = sasquatch_v0.env(num_players=3, render_mode="ansi")

Use the same masked AEC loop shown above. Hands and unknown facedown deal cards stay private; contributors can see their own cards. Wins are checked after all sets resolve and hands refill. The unique leader must have four points with 3–4 players, or five points with 2 or 5–6 players; ties continue. Rewards are +1 for the winner and −1 for opponents. The default limit is 10,000 decisions; max_steps=None disables it.

See the supplied rules and environment reference for the action and observation layout, sealed offers, Thingamabob opportunities, and set-resolution conventions.

No Thanks!

game_room.no_thanks_v0 implements the base game for 3–7 players, with private chip counts, nine unseen removed cards, consecutive-run scoring, and shared wins.

from game_room import no_thanks_v0

env = no_thanks_v0.env(num_players=3, render_mode="ansi")

Actions are 0 (take the card and its chips) and 1 (pay a chip to pass). Taking a card leaves the same player to decide on the next card. Use the masked AEC loop above; a player without chips must take. Lowest final penalty score wins. Terminal rewards are +1 for each winner and −1 for other players.

See the rules and API reference for observations, scoring, and the AMIGO base-game rules. The special-card expansion is excluded.

Kingdomino

game_room.kingdomino_v0 implements the 2017 base game for 2–4 players, including tile drafting, rotating turn order, two kings per player in two-player games, 5×5 placement constraints, territory scoring, and both tie-breakers.

from game_room import kingdomino_v0

env = kingdomino_v0.env(num_players=4, render_mode="ansi")

Use the masked AEC loop above. Placement and choosing the next domino are separate decisions. The board uses a 9×9 canvas so the castle can occupy any position within the final 5×5 kingdom. A domino can be discarded only when no legal placement exists. Rewards are +1 for each winner and −1 for other players.

No Thanks! and Kingdomino support ansi and human rendering and an optional max_steps limit (default 10,000; None disables it). Intermediate and truncation rewards are zero. Final scores and winners are available in terminal info.

See the rules, tile inventory sources, and API reference for action encoding, observations, and the pinned three-player setup. Optional variants and expansions are excluded.

Harmonies

game_room.harmonies_v0 implements the base game for 1–4 players, with all 32 animal cards, both board sides, solo play, and the ten optional Nature's Spirits. It supports token stacking, rotated habitats, permanent animal placements, interleaved turn actions, landscape scoring, and equal-turn game endings.

from game_room import harmonies_v0

env = harmonies_v0.env(
    num_players=2, board_side="A", nature_spirits=False, render_mode="ansi"
)

Use the masked AEC loop above. Taking tokens, placing each token, drafting an animal, settling a cube, and ending the turn are separate decisions. Multiplayer terminal rewards are +1 for winners and −1 for other players. In solo mode, the terminal reward is the final score; info["suns"] reports the solo rating.

See the rules, component sources, and API reference for habitat patterns, scoring, coordinates, and observation details.

Ticket to Ride

game_room.ticket_to_ride_v0 implements the 2025 North America base game for 2–5 players: 100 routes, 33 destination tickets, private hands and tickets, train-card drafting, locomotive payments, double-route restrictions, ticket selection and returns, the final round, and the longest continuous path bonus.

from game_room import ticket_to_ride_v0

env = ticket_to_ride_v0.env(num_players=4, render_mode="ansi")

Use the masked AEC loop above. Opening setup offers four tickets and requires keeping at least two. Claims separate route selection from payment; later ticket draws allow the player to choose both the kept subset and rejected-card order. Terminal rewards are +1 for winners and −1 for other players.

Harmonies and Ticket to Ride support ansi and human rendering, seeded resets, and max_steps (default 10,000; None disables the limit). Intermediate and truncation rewards are zero. Final scores and winners are in terminal info.

See the rules, action and observation reference for the pinned edition, component IDs, hidden information, and conventions for exhausted card supplies.

Reporting issues

If you run into problems, notice a bug, or find that an environment doesn't follow the game's rules, please open an issue. Reports and rule corrections help make these environments more reliable.

When possible, include the environment name, package version, expected and actual behavior, and a small example or seed and action sequence that reproduces the problem. For rules discrepancies, a rulebook link or page reference is especially helpful. You don't need a complete reproduction to report a concern.

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 for every environment, controlled rule scenarios, hidden-information checks, and complete games checking resource and 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.3.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.3.0
File Size Uploaded Provenance Actions
game_room-0.3.0.tar.gz 101.3 kB Without provenance Details for game_room-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 152.3 kB

Release files / game_room-0.3.0.tar.gz

Download URL game_room-0.3.0.tar.gz
Size 101.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e72f69f8f27398305fb22af8386dd31636bae80e70c368533d6f15f89254a494
BLAKE2b-256 checksum
How to use checksums
5837fef0bf3681264a732a811fe646e9dce2f02c385c6d98f329043767b38b97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL game_room-0.3.0-py3-none-any.whl
Size 51.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c3f28eb5ecce2826ae05f91fd569ab6ef6d91c1383985a8da4bb1c6fa571f76
BLAKE2b-256 checksum
How to use checksums
db44e9853c08769d7f0b5ca0eb370cbf34d11afc4831cc7241a2e51e48c9d420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for game-room 0.3.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