A Gymnasium-compatible implementation of hardmaze environment
Project description
Gymnasium HardMaze
A maze navigation simulator for reinforcement learning research, compatible with the Gymnasium API.
Overview
Gymnasium HardMaze is a reimplementation of the 'hardmaze' environment used in several neuroevolution research papers. It provides a platform for training and evaluating reinforcement learning agents in navigation tasks of varying complexity.
Key features:
- XML-based maze configuration
- Fully compatible with Gymnasium API
- Deterministic when seeded for reproducible research
- Visualizations for debugging and demonstrations
Installation
# Basic installation
pip install gymnasium-hardmaze
# For development
git clone https://github.com/Teaspoon-AI/gymnasium-hardmaze.git
cd gymnasium-hardmaze
pip install -e .
Usage
Basic Example
import gymnasium as gym
import gymnasium_hardmaze
import numpy as np
# Create default maze environment
env = gym.make("HardMaze-v0", render_mode="human")
# Reset the environment
observation, info = env.reset(seed=42)
for _ in range(1000):
# Take a random action
action = env.action_space.sample()
# Step the environment
observation, reward, terminated, truncated, info = env.step(action)
# Check if episode is done
if terminated or truncated:
observation, info = env.reset()
env.close()
Keyboard Control Example
The package includes a keyboard control script for testing environments:
# Run keyboard agent in the hard maze environment
python -m gymnasium_hardmaze.examples.keyboard_agent
Available Environments
| Environment ID | Description |
|---|---|
HardMaze-v0 |
Complex maze with walls and multiple points of interest |
Observation Space
The observation space is a vector containing:
- Normalized rangefinder readings (distance to walls)
- Radar readings (binary detection of goal)
Action Space
The action space is a 3-dimensional continuous space:
[left_motor, forward, right_motor]with values between 0 and 1
Rewards
The default reward function prioritizes reaching the goal, with partial rewards for visiting points of interest along the way.
Citation
If you use this software in your research, please cite:
@software{gymnasium-hardmaze,
author = {Stefano Palmieri},
title = {HardMaze: A Gymnasium-compatible Implementation of hardmaze environment},
url = {https://github.com/Teaspoon-AI/gymnasium-hardmaze},
year = {2025},
}
Acknowledgements
This project uses a fitness function derived from Sebastian Risi's 2011 ES-HyperNEAT paper, ported to Python and adapted to work with the Gymnasium API.
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_hardmaze-0.1.0.tar.gz.
File metadata
- Download URL: gymnasium_hardmaze-0.1.0.tar.gz
- Upload date:
- Size: 22.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abc2ac0bf76d422d6c8f33389f644da445747714cb659bc61da4d07c925943fe
|
|
| MD5 |
469f501097fbe530738a9a42464c4b29
|
|
| BLAKE2b-256 |
8a5944c9c7b38d911fbaf482d28fdc542e0f4b0881b776d7b10ddd84dcfc8a8e
|
File details
Details for the file gymnasium_hardmaze-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gymnasium_hardmaze-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8491f8ca794521c4ad37778beb48eb4f6495c427d865965d4bec9ea4b40f0727
|
|
| MD5 |
75d41ae3479685847fd83ede8ef323f4
|
|
| BLAKE2b-256 |
236d164589e5962b09c1502bc18115f1e041620fb1eac7f2fe460b04d88c5cfc
|