Skip to content

Match Environment

gwent.rl.pettingzoo exposes the match-only environment.

from gwent.rl.pettingzoo import env, raw_env

env(...) wraps the raw environment with PettingZoo's AssertOutOfBoundsWrapper and OrderEnforcingWrapper. raw_env(...) returns GwentPettingZooEnv directly.

Constructor

raw_env(
    *,
    decks=None,
    seed=0,
    first_player=0,
    strict_effects=True,
    catalog_version=STANDALONE_VERSION,
    render_mode=None,
)
Option Meaning
decks Optional tuple of two DeckList objects. Defaults to the shared demo deck for mirror testing.
seed Seed used to create the core deterministic RNG.
first_player 0 or 1; invalid values raise ValueError.
strict_effects Passed into core match setup and deck validation.
catalog_version Card catalog version used for categorical card ids.
render_mode None or "ansi".

reset(options=...) can override decks, first_player, and strict_effects for that reset.

Agents And Spaces

The possible agents are always:

("player_0", "player_1")

Each agent has:

  • Discrete(349) action space.
  • Dict({"observation": MultiDiscrete(...), "action_mask": MultiBinary(349)}) observation space.

The current generated reference reports the exact observation schema and action layout:

Rewards

Rewards are sparse and terminal:

Result player_0 player_1
player_0 wins +1.0 -1.0
player_1 wins -1.0 +1.0
Draw 0.0 0.0
Non-terminal step 0.0 0.0

At game over both agents terminate, neither truncates, and PettingZoo dead-step handling removes agents from the active list.

Infos

infos[agent] contains:

  • legal_action_ids: the sorted legal discrete action ids for the active live agent, otherwise an empty list.
  • events: serializable event dictionaries from the last core engine step.

Rendering

render_mode="ansi" returns a compact text snapshot with phase, round, active agent, scores, player counts, row contents, and pending-choice count. render_mode=None disables rendering.