Pickomino (Heckmeck) Gymnasium environment
Project description
Pickomino-Env
Description
An environment conforming to the Gymnasium API for the dice game Pickomino (Heckmeck am Bratwurmeck) Goal: train a Reinforcement Learning agent for optimal play. Meaning, decide which face of the dice to collect, when to roll and when to stop.
Action Space
The Action space is a tuple with two integers. Tuple (int, int)
Action = [dice_face (0-5), action_type (0=roll, 1=stop)].
-
0-5: Face of the dice, which you want to take, where:
- 0 -> face 1
- 1 -> face 2
- 2 -> face 3
- 3 -> face 4
- 4 -> face 5
- 5 -> face worm
-
0-1: Roll (0) or stop (1).
Observation Space
The observation is a dict with shape (4,) with the values corresponding to the following: dice, table and player.
| Observation | Min | Max | Shape |
|---|---|---|---|
| dice_collected | 0 | 8 | (6,) |
| dice_rolled | 0 | 8 | (6,) |
| tiles_table | 0 | 1 | (16,) |
| tile_players | 0 | 36 | number_of_players |
Note: There are eight dice to roll and collect. A die has six sides with the number of eyes one through five, but a worm instead of a six. The values correspond to the number of eyes, with the worm also having the value five (and not six!). The 16 tiles are numbered 21 to 36 and have worm values from one to four in spread in four groups. The game is for two to seven players. Here your Reinforcement Learning Agent is the first player. The other players are computer bots. The bots play, according to a heuristic. When you create the environment, you have to define the number of bots.
For a more detailed description of the rules, see the file pickomino-rulebook.pdf. You can play the game online here: https://www.maartenpoirot.com/pickomino/. The heuristic used by the bots is described here: https://frozenfractal.com/blog/2015/5/3/how-to-win-at-pickomino/.
Rewards
The goal is to collect tiles in a stack. The winner is the player, which at the end of the game has the most worms on her tiles. For the Reinforcement Learning Agent a reward equal to the value (worms) of a tile is given when the tile is picked. For a failed attempt (see rulebook), a corresponding negative reward is given. When a bot steals your tile, no negative reward is given. Hence, the total reward at the end of the game can be greater than the score.
Starting State
dice_collected= [0, 0, 0, 0, 0, 0].dice_rolled= [3, 0, 1, 2, 0, 2] Random dice, sum = 8.tiles_table= [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1].tile_players= [0, 0, 0] (with number_of_bots = 2).
Episode End
The episode ends if one of the following occurs:
- Termination: If there are no more tiles to take on the table = Game Over.
- Termination: Action out of allowed range [0–5, 0-1].
Truncation
Truncation: Attempt to break the rules, the game continues, and you have to give a new valid action.
Failed Attempt
Note that a Failed Attempt means: If a tile is present, put it back on the table and get a negative reward. However, the game continues, so the Episode does not end.
Arguments
These must be specified.
| Parameter | Type | Default | Description |
|---|---|---|---|
number_of_bots |
int | 1 | Number of bot opponents (1-6) you want to play against |
render_mode |
str or None | None | Visualization mode: None (training), "human" (display), or "rgb_array" (recording) |
Setup
pip install pickomino-env
Usage example
import gymnasium as gym
# Create environment
env = gym.make("Pickomino-v0", render_mode="human", number_of_bots=2)
# Reset and get initial observation
obs, info = env.reset(seed=42)
# Run one episode
terminated = False
truncated = False
total_reward = 0
while not terminated and not truncated:
# Agent selects action: (dice_face, roll_choice)
action = env.action_space.sample() # Random action for demo
# Step environment
obs, reward, terminated, truncated, info = env.step(action)
total_reward += reward
if truncated:
print(f"Invalid action: {info['explanation']}")
break
print(f"Episode finished. Total reward: {total_reward}")
env.close()
Resources
- Game Rules: Pickomino Rulebook
- Play Online: Maarteen Poirot's Pickomino
- Bot Strategy: How to Win at Pickomino
- Repository: smallgig/Pickomino
- Gymnasium: https://gymnasium.farama.org/
License
MIT License. See LICENSE for details.
Project details
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 pickomino_env-1.2.0.tar.gz.
File metadata
- Download URL: pickomino_env-1.2.0.tar.gz
- Upload date:
- Size: 24.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52a7b46d80daee16ed0167f5697954f91bb1ea3af2274568f46c17e16d0899dc
|
|
| MD5 |
c5fc90656131e0bc5da48b779dad3d96
|
|
| BLAKE2b-256 |
e7045cc72459e23fd6b183058663f82232fcc378d1fab8337a1dd6430931f44f
|
Provenance
The following attestation bundles were made for pickomino_env-1.2.0.tar.gz:
Publisher:
python-publish.yml on smallgig/Pickomino
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pickomino_env-1.2.0.tar.gz -
Subject digest:
52a7b46d80daee16ed0167f5697954f91bb1ea3af2274568f46c17e16d0899dc - Sigstore transparency entry: 955480576
- Sigstore integration time:
-
Permalink:
smallgig/Pickomino@3972d1aab1b21c29a6a9ac614f457256a17bfdf8 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/smallgig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3972d1aab1b21c29a6a9ac614f457256a17bfdf8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pickomino_env-1.2.0-py3-none-any.whl.
File metadata
- Download URL: pickomino_env-1.2.0-py3-none-any.whl
- Upload date:
- Size: 25.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb16828687a20f2d4008392777bdfbb0325ba68bb6c0e0d038cc3f4b2574d5a0
|
|
| MD5 |
753c1268acf968474dee965cf17a4faf
|
|
| BLAKE2b-256 |
a9c53db4b16bcd5eaaf5751680b52dd05d7defb263e89d217eeb443604ba4f0d
|
Provenance
The following attestation bundles were made for pickomino_env-1.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on smallgig/Pickomino
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pickomino_env-1.2.0-py3-none-any.whl -
Subject digest:
fb16828687a20f2d4008392777bdfbb0325ba68bb6c0e0d038cc3f4b2574d5a0 - Sigstore transparency entry: 955480596
- Sigstore integration time:
-
Permalink:
smallgig/Pickomino@3972d1aab1b21c29a6a9ac614f457256a17bfdf8 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/smallgig
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3972d1aab1b21c29a6a9ac614f457256a17bfdf8 -
Trigger Event:
release
-
Statement type: