Skip to content

Commit

Permalink
docs: minimal readme
Browse files Browse the repository at this point in the history
- encourage to visit docs
  • Loading branch information
koulanurag committed Feb 15, 2024
1 parent a8c40c3 commit 1405e30
Showing 1 changed file with 24 additions and 74 deletions.
98 changes: 24 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# maze-world

Random maze environments with different size and complexity for reinforcement learning research.
Random maze environments with different size and complexity for reinforcement learning and planning research. This is in-particular to challenge generalization and planning ability in dynamically changing environment.

![Python package](https://github.com/koulanurag/maze-world/workflows/Python%20package/badge.svg)
![Python Version](https://img.shields.io/pypi/pyversions/maze-world)
Expand Down Expand Up @@ -41,78 +41,27 @@ _Disclaimer: This project is largely a amalgam of references mentioned <a href=#
</table>
</div>

## Usage:

1. Basics:

```python
import gymnasium as gym
env = gym.make("maze_world:RandomMaze-11x11-v0", render_mode="human")
terminated, truncated = False, False
observation, info = env.reset(seed=0, options={})
episode_score = 0.
while not (terminated or truncated):
action = env.action_space.sample()
observation, reward, terminated, truncated, info = env.step(action)
episode_score += reward
env.close()
```
2. Creating custom size random maze:
```python
import gymnasium as gym
import maze_world
gym.envs.register(
id='RandomMaze-7x7-v0',
entry_point='maze_world.envs:RandomMazeEnv',
max_episode_steps=200,
kwargs={
"maze_width": 7,
"maze_height": 7,
"maze_complexity": 1,
"maze_density": 1,
},
)
env = gym.make("maze_world:RandomMaze-7x7-v0")
```
3. Creating maze with pre-specified map:
```python
import gymnasium as gym
def _generate_maze_fn():
# This function would be called on every reset
maze_map = [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1]
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1]
[1, 1, 1, 1, 1, 1, 1, 0, 0, 1]
[1, 1, 1, 1, 1, 1, 1, 0, 0, 1]
[1, 1, 1, 1, 1, 1, 1, 0, 0, 1]
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1]
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
agent_loc = [1, 1]
target_loc = [1, 7]
return maze_map, agent_loc, target_loc
gym.envs.register(
id='UMaze-v0',
entry_point='maze_world.envs:MazeEnv',
max_episode_steps=200,
kwargs={
"generate_maze_fn": _generate_maze_fn,
"maze_height": 9,
"maze_wwidth": 9,
},
)
env = gym.make("maze_world:UMaze-v0")
```
See all [here](https://koulanurag.dev/maze-world/environments.html)

## Quick-Start:
```python
import gymnasium as gym
env = gym.make("maze_world:RandomMaze-11x11-v0", render_mode="human")
terminated, truncated = False, False
observation, info = env.reset(seed=0, options={})
episode_score = 0.
while not (terminated or truncated):
action = env.action_space.sample()
observation, reward, terminated, truncated, info = env.step(action)
episode_score += reward
env.close()
```
See entire Quick-start guide [here](https://koulanurag.dev/maze-world/quick-start.html).
## Testing:
- Install: ```pip install -e ".[test]" ```
Expand All @@ -127,4 +76,5 @@ If you would like to develop it further; begin by installing following:
## References:
1. [Gym-Maze](https://github.com/MattChanTK/gym-maze)
2. [Mazelab](https://github.com/zuoxingdong/mazelab)
3. [Custom Gym environment based out of gymnasium](https://gymnasium.farama.org/tutorials/gymnasium_basics/environment_creation/)
3. [Custom Gym environment based out of gymnasium](https://gymnasium.farama.org/tutorials/gymnasium_basics/environment_creation/)
4. [Wilson Maze Generator](https://github.com/CaptainFl1nt/WilsonMazeGenerator)

0 comments on commit 1405e30

Please sign in to comment.