Skip to main content

ParkingLotGym

codecov PyPI version

A custom AI Gymnasium environment for the Rush hour puzzle: https://en.wikipedia.org/wiki/Rush_Hour_(puzzle).

Library used: GitHub.

Example solvable in 60 moves

Random moves are used for this demo. Click on .gif if still.

ParkingLot60

Example solvable in 5 moves

Random moves are used for this demo. Click if .gif if still.

ParkingLot5

Usage

Initiating the env via gym

import gymnasium as gym

env_6x6_random = gym.make('Puzzle6x6Moves15-v0')
env_4x4_random = gym.make('Puzzle6x6Moves30-v0')

env_6x6_fixed = gym.make('Puzzle6x6Moves13Fixed-v0')
env_6x6_fixed = gym.make('Puzzle6x6Moves6Fixed-v0')

Initiating the env directly

from parkinglotgym import ParkingLotEnv

env_random = ParkingLotEnv(15)
env_fixed = ParkingLotEnv
("""
    ....O
    FF..O
    .AA..
    ..BB.
    .CC..
    .DD..
""")

Making moves

import gymnasium as gym

env_3x3_fixed = gym.make('Puzzle6x6Moves13Fixed-v0')

# Reset the environment
observation, info = env_3x3_fixed.reset()

# Make a random valid move
import random

# Grab list of vehicles with their available moves.
available_moves = info["available_moves"]
# Drop moves from now, leave only vehicles.
movable_vehicles = [v for v, moves in available_moves.items()]
# Select a random vehicle to move.
vehicle = random.choice(movable_vehicles)
# Select a random move for the chosen vehicle.
move = random.choice(available_moves[vehicle])

# Render the environment. The only render mode is 'human' which renders visual output.
env_3x3_fixed.render()

# Close the environment
env_3x3_fixed.close()

Environment Details

  • Action Space: MultiDiscrete([num_vehicles, max_moves*2], start=[2, -max_moves]) - First value selects vehicle ID (starting at 2), second value indicates steps to move (negative for backward, positive for forward). Moving 0 steps is not allowed.
  • Observation Space: Box(0, num_vehicles+1, (height, width), int32). Contains values: 0 for empty cells, 1 for walls, 2 and up for vehicles. '2` represents the main vehicle.
  • Reward: 0 if the puzzle is solved, -1 if not solved yet, -2 if invalid move.
  • Done: True if the puzzle is solved, False otherwise.

Metadata

Release files for parkinglotgym 1.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for parkinglotgym 1.1.3
File Size Uploaded Provenance
parkinglotgym-1.1.3.tar.gz 18.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for parkinglotgym 1.1.3
File Interpreter ABI Platform
parkinglotgym-1.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 35.9 kB

Release files / parkinglotgym-1.1.3.tar.gz

Download URL parkinglotgym-1.1.3.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8982846533abe2c235ab1de8cb50f26a1510a4812f9e3b304f8297fece4cd48f
BLAKE2b-256 checksum
How to use checksums
9d705f870685ff55d51b3b3ca45d7807862af80ecdc319e161ece1087f90fe40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / parkinglotgym-1.1.3-py3-none-any.whl

Download URL parkinglotgym-1.1.3-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f1f9a7d8b960577007a04f96ebcb912a36a1f2b305053c6369fb98c9a91e38a
BLAKE2b-256 checksum
How to use checksums
7f3e6905e6ce6a08bbf521dd4da76afddcae0aacaed512d1d2735d277c5f004a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Security for parkinglotgym 1.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page