A Gymnasium environment for SPaRC puzzles
Project description
Gym Environment for SpaRC Project
Description
A custom Gymnasium environment for SPaRC. The Game and Dataset was develop by: https://sparc.gipplab.org/ . This project allows reinforcement learning (RL) agents and humans to interact/play the puzzles used in SPaRC. For how the puzzles work also look up https://sparc.gipplab.org/ .
Arguments when creating the Gym Env:
- puzzles(pd.DataFrame) The puzzles that should be used. The puzzles must come in the shape of https://sparc.gipplab.org/ .
- traceback (bool) When set to True it allows the Agent to move back on his path, if False it does not.
- render_mode(str) Optional, If render_mode='human' the Gym Environment will visualize every step using
pygame. - max_steps(int) Optional, the maximum amount of steps the Gym environment will runbefore it terminates.
Installation and Usage
how to use:
- clone the repository
- install the dependecies
- Run Final_Product.py to play as a human or customize Final_product.py how you want to use the gym
Packages with Versions:
- gymnasium=0.28.1
- numpy=1.26.4
- pygame=2.2.0
- yaml=0.2.5
- pandas=2.2.1
Environment Details
Action Space
- Discrete(4): Represents the four possible moves:
- 0: Right
- 1: Up
- 2: Left
- 3: Down
Observation Space
- Dict A Dictionary of:
- base: Dict: A dictionary of 2D arrays representing the puzzle state:
"visited": Tracks visited cells."gaps": Represents gaps in the grid."agent_location": Current position of the agent."target_location": Goal position.- Additional keys for unique properties like
"stars","triangles", etc. - The 2D Arrays are of the shape of the puzzle and are One-hot Encoded
- color: list: A 2D Array representing the colors of the properties.
- 8 possible colors are represented with 1-8
- 2D Array is of shape of the puzzle
- additional_info: list A 2D Array with additiional Info about the puzzle
- 2D Array is of shape of the puzzle
- Possible additiona_info:
- ID of the polyshape
- Count of the Triangles
- base: Dict: A dictionary of 2D arrays representing the puzzle state:
Reward System
- Sparse Rewards:
- Outcome Reward:
+1: For solving the puzzle.0: For intermediate steps.-1: for Failing.
- Normal Reward:
+1: For solving the puzzle.-1: For Failing.+0.01: For staying on a solution path on each step.
- Outcome Reward:
Visualization
The environment uses pygame for rendering:
- Agent: Blue square.
- Target: Red square.
- Gaps: Dark Green cells.
- Visited cells: light Green cells.
- Unique Properties:
- Stars: colored star.
- Square: colored square.
- Triangles: Colored triangles with counts.
- Polyshapes: Colored polygons.
- Ylop: Colored Polygons with marker ylop.
- Dots: Small black circles.
Folder Structure
- Gym-TheWitnessGame/ # Custom environment implementation
- gymnasium_env/ # Core environment logic
- init.py # Environment initialization
- gym_Witness.py # Core environment logic
- register_env.py # Environment registration
- Final_Product.py # Main script for human interaction
- human_play.py # Function for human play
- README.md # Project documentation
- gymnasium_env/ # Core environment logic
Acknowlegdments
Special thanks to Lars Benedikt Kaesberg (l.kaesberg@uni-goettingen.de) and Jan Philip Wahle for giving me the opportunity to do this Project aswell as supervising the Project.
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 gym_env_sparc-0.1.1.tar.gz.
File metadata
- Download URL: gym_env_sparc-0.1.1.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
007204657bb725df5ca6e0867222634c90ee2e061f429f2d753f43d40261cd5d
|
|
| MD5 |
fa75e07f3497a2da370224ebb989ad4d
|
|
| BLAKE2b-256 |
c90fc6ccdd2d37f8ef4864985a7174e2eb1a7e8397ee6fcce8bfce8689edc897
|
File details
Details for the file gym_env_sparc-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gym_env_sparc-0.1.1-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf0431ef806540d982fcb2c98771e5fe72670c7f06d7f74e5151d724f85f5cf4
|
|
| MD5 |
a490a2a2ae662ff112b364a88ad4f06e
|
|
| BLAKE2b-256 |
f94497aea6757d8fcf113d10d8bcf8054b0dad7130e045ea0b0db2fa1689d23c
|