Metadata-Version: 2.4
Name: fish-env
Version: 0.2.0
Summary: A PettingZoo environment for the six-player card game Fish.
Keywords: fish,card game,pettingzoo,multi-agent,reinforcement learning,benchmark
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Typing :: Typed
Requires-Dist: fish-rules>=0.2,<0.3
Requires-Dist: pettingzoo>=1.27
Requires-Dist: gymnasium>=1.4
Requires-Dist: numpy>=2.5
Requires-Python: >=3.14
Project-URL: Homepage, https://github.com/thetruthisntsweet/fish
Project-URL: Documentation, https://github.com/thetruthisntsweet/fish/tree/main/docs
Project-URL: Changelog, https://github.com/thetruthisntsweet/fish/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/thetruthisntsweet/fish/issues
Description-Content-Type: text/markdown

# fish-env

A [PettingZoo](https://pettingzoo.farama.org) AEC environment for **Fish**, a six-player team
card game of asking, deduction and calls, and the environment of the
[Fish benchmark](https://github.com/thetruthisntsweet/fish).

- Six agents, `seat_0` to `seat_5`, in two teams of three.
- Each agent observes only what its seat may know (its own hand, the public state and the
  most recent event) as 648 bits, with a mask over 913 actions.
- Declaration windows after every event, decided by a seeded priority order between teams.
- Deterministic: `reset(seed=...)` gives the same game every time, and every game can be saved
  as a record and replayed exactly.
- Passes PettingZoo's own API and seed tests.
- Agent memory for training: `memory_env(remembered)` puts the observations each agent had
  just after the events it remembers (all, the latest k, or none) in its `infos`.

```python
import numpy as np
from fish_env import env

game = env()
game.reset(seed=42)
rng = np.random.default_rng(0)
for agent in game.agent_iter():
    observation, reward, terminated, truncated, info = game.last()
    if terminated or truncated:
        action = None
    else:
        action = int(rng.choice(np.flatnonzero(observation["action_mask"])))
    game.step(action)
```

With memory, each agent's `infos` holds what it remembers:

```python
import numpy as np
from fish_env import memory_env

game = memory_env(remembered=8)  # each agent remembers the last 8 events; None for all
game.reset(seed=42)
rng = np.random.default_rng(0)
for agent in game.agent_iter():
    observation, reward, terminated, truncated, info = game.last()
    past = info["memory"]  # the observations just after the events it remembers: (n, 648)
    assert past.shape[0] <= 8
    if terminated or truncated:
        action = None
    else:
        action = int(rng.choice(np.flatnonzero(observation["action_mask"])))
    game.step(action)
```

Install with `pip install fish-env` (Python 3.14 or later). The rules engine is
[fish-rules](https://pypi.org/project/fish-rules/); baseline agents are in
[fish-agents](https://pypi.org/project/fish-agents/). The environment guide is in the
[repository](https://github.com/thetruthisntsweet/fish/blob/main/docs/environment.md).

Licensed under Apache-2.0.
