Gymnasium environments for the Orchard cooperative dice game
Project description
gymnasium-orchard
Gymnasium environments for the cooperative dice game Orchard (First Orchard).
Background and analysis: Recommend.Games blog
Installation
pip install gymnasium-orchard
Usage
import gymnasium as gym
import orchard # registers the environments
env = gym.make("Orchard-round")
obs, info = env.reset(seed=42)
terminated = False
while not terminated:
action = env.action_space.sample() # or your policy
obs, reward, terminated, truncated, info = env.step(action)
Environments
Orchard-round
One step() = one die roll. The agent provides an action every step; it is only applied when the basket face is rolled.
Orchard-decision
One step() = one basket decision. The environment advances automatically through fruit-tree and raven rolls, pausing only when a basket is rolled or the game ends. Cleaner for tabular RL methods.
Observation space
Both environments use the same observation space:
| Key | Space | Description |
|---|---|---|
fruits |
Box(int8, shape=(num_trees,)) |
Fruits remaining on each tree |
raven |
Discrete(raven_steps + 1) |
Raven's distance from the orchard |
Action space
Discrete(num_trees) — which tree to pick from on a basket roll. Ignored on all other rolls; falls back to the tree with the most fruit if the chosen tree is empty.
Reward
Sparse: +1 on win (all fruit picked), -1 on loss (raven reaches the orchard), 0 otherwise.
Info dict
Both environments include an action_mask in info on every step:
info["action_mask"] # np.int8 array, 1 = tree has fruit, 0 = empty
Orchard-round additionally includes the die result:
info["die"] # int, face rolled
info["basket"] # bool, whether it was a basket roll
info["action_applied"] # bool, whether the action was used
Orchard-decision includes the rolls that were skipped:
info["auto_rolls"] # list[int], die values of non-basket rolls since last step
Configuration
Pass an OrchardGameConfig to customise the game:
from orchard.game import OrchardGameConfig
config = OrchardGameConfig(
num_trees=4,
fruits_per_tree=10,
fruits_per_basket_roll=2,
raven_steps=9,
)
env = gym.make("Orchard-round", config=config)
Licence
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gymnasium_orchard-0.1.0.tar.gz.
File metadata
- Download URL: gymnasium_orchard-0.1.0.tar.gz
- Upload date:
- Size: 221.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d506668e96d1ead408b87bac00e0defa657d50f084b35e1a023a000716c2ceb
|
|
| MD5 |
0f1e645b5f003b74da82d4d18456377b
|
|
| BLAKE2b-256 |
c79d504e8a374041912294c964e96558d8c7dd1dcfc7889d96dd1eeb51ba72ec
|
File details
Details for the file gymnasium_orchard-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gymnasium_orchard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fb8fd0bde09ea31693c72231ee69142756bd0c0334bfb04632e756cc3f5e5f9
|
|
| MD5 |
e01223c7c858af2694d51ae1364568fb
|
|
| BLAKE2b-256 |
61c1e76ebe3573c38543551d117fa1efaf41d6c94b0374c5b70fc3ba7e45204b
|