Procedural Frozen Lake — a Gymnasium environment with generated maps
Project description
Procedural Frozen Lake
A Gymnasium environment that extends Frozen Lake with procedurally generated maps.
Procedural-FrozenLake-v1 provides:
- Variable rectangular grids — independent
min_width/max_widthandmin_height/max_heightbounds. - Flexible start and goal placement — fixed positions, lists of positions, or probabilistic placement across the grid; multiple starts and goals are supported.
- Per-goal rewards — sample or specify a different reward for each goal tile.
- Fresh maps on reset — pass
options={"regenerate_map": True}to sample a new valid layout without rebuilding the env. - Stable observation space — variable-size maps share a fixed
Discrete(max_width * max_height)space so it does not change when maps regenerate. - Optional supervision signals —
emit_map=Trueandemit_q_star=Trueexpose the layout and optimal Q-values ininfo.
Install
pip install procedural-frozenlake
For development:
git clone https://github.com/micahr234/procedural-frozenlake.git
cd procedural-frozenlake
source scripts/install.sh
Quick start
Importing the package registers the environment with Gymnasium:
import gymnasium as gym
import procedural_frozenlake # registers Procedural-FrozenLake-v1
env = gym.make(
"Procedural-FrozenLake-v1",
map_seed=0,
emit_map=True,
emit_q_star=True,
step_penalty=-0.01,
)
obs, info = env.reset(seed=1)
print(info["map"]) # JSON string with board layout and goal rewards
print(info["q_star"]) # optimal Q-values for the current state
for _ in range(100):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
if terminated or truncated:
obs, info = env.reset()
env.close()
See examples/random_rollout.ipynb for a worked example.
Environment
ID: Procedural-FrozenLake-v1
Maps are generated lazily on the first reset(), not during construction. By default, each env instance keeps one generated map across resets.
Constructor parameters
| Parameter | Default | Description |
|---|---|---|
is_slippery |
False |
Stochastic sliding (standard FrozenLake behavior) |
min_hops |
3 |
Minimum shortest-path length from start to goal |
min_width, max_width |
3, 8 |
Map width bounds |
min_height, max_height |
3, 8 |
Map height bounds |
hole_prob |
0.2 |
Probability a tile becomes a hole |
start_pos, start_pos_prob |
None |
Fixed start tile(s) or probability of placing starts |
goal_pos, goal_pos_prob |
None |
Fixed goal tile(s) or probability of placing goals |
fixed_map |
None |
Fixed layout (list of row strings or dict with board/rewards) |
emit_q_star |
False |
Inject optimal Q-values in info["q_star"] |
emit_map |
False |
Inject map layout in info["map"] |
goal_reward_low, goal_reward_high |
1.0, 1.0 |
Per-goal reward sampling bounds |
step_penalty |
0.0 |
Added to every step reward (e.g. -0.01) |
map_seed |
None |
Seed for map generation (independent of reset seed) |
Reset options
Pass options={"regenerate_map": True} to reset() to generate a new map. Not available when fixed_map is set.
Contributing
See CONTRIBUTING.md.
License
GNU General Public License v3.0 — see LICENSE.
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 procedural_frozenlake-0.1.0.tar.gz.
File metadata
- Download URL: procedural_frozenlake-0.1.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.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82512298423e647e6c431ee7ff74b53add0c688ca392f83f99ed2363add59b04
|
|
| MD5 |
a47046f27001ccd2e662b3739c6463a1
|
|
| BLAKE2b-256 |
8b6dbdae127f152b50675dc944c6a56c79771728087ecd3b22cb82d8ecd116cd
|
Provenance
The following attestation bundles were made for procedural_frozenlake-0.1.0.tar.gz:
Publisher:
publish.yml on micahr234/procedural-frozenlake
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
procedural_frozenlake-0.1.0.tar.gz -
Subject digest:
82512298423e647e6c431ee7ff74b53add0c688ca392f83f99ed2363add59b04 - Sigstore transparency entry: 2104060521
- Sigstore integration time:
-
Permalink:
micahr234/procedural-frozenlake@0d523ba16b79531075711753653dbfed4c32c336 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/micahr234
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0d523ba16b79531075711753653dbfed4c32c336 -
Trigger Event:
push
-
Statement type:
File details
Details for the file procedural_frozenlake-0.1.0-py3-none-any.whl.
File metadata
- Download URL: procedural_frozenlake-0.1.0-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bcc7b692ba852901cae862e0d02c27f2faca40d8d24e72fb4af97aa8e0a35a43
|
|
| MD5 |
53780e1483f2b5d92af714fd329ccbc1
|
|
| BLAKE2b-256 |
f19ec557fe5e02c566b664d4efaf961c9572f2e735d33ab5d67a15d79b2cbd95
|
Provenance
The following attestation bundles were made for procedural_frozenlake-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on micahr234/procedural-frozenlake
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
procedural_frozenlake-0.1.0-py3-none-any.whl -
Subject digest:
bcc7b692ba852901cae862e0d02c27f2faca40d8d24e72fb4af97aa8e0a35a43 - Sigstore transparency entry: 2104060869
- Sigstore integration time:
-
Permalink:
micahr234/procedural-frozenlake@0d523ba16b79531075711753653dbfed4c32c336 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/micahr234
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@0d523ba16b79531075711753653dbfed4c32c336 -
Trigger Event:
push
-
Statement type: