Skip to content

Commit

Permalink
Add Room Size Customization to MiniGrid MultiRoom Environment (#457)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Towers <[email protected]>
  • Loading branch information
BartekCupial and pseudo-rnd-thoughts authored Jan 13, 2025
1 parent f9398ba commit 939ae21
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions minigrid/envs/multiroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,27 @@ class MultiRoomEnv(MiniGridEnv):
## Registered Configurations
S: size of map SxS.
N: number of rooms.
- `MiniGrid-MultiRoom-N2-S4-v0` (two small rooms)
- `MiniGrid-MultiRoom-N4-S5-v0` (four rooms)
- `MiniGrid-MultiRoom-N6-v0` (six rooms)
## Arguments
* `minNumRooms`: The minimum number of rooms generated
* `maxNumRooms`: The maximum number of rooms generated
* `maxRoomSize=10`: The maximum room size
* `width=25`: The width of the map
* `height=25`: The height of the map
* `max_steps=None`: If none, `maxNumRooms * 20` else the integer passed
"""

def __init__(
self,
minNumRooms,
maxNumRooms,
maxRoomSize=10,
width=25,
height=25,
max_steps: int | None = None,
**kwargs,
):
Expand All @@ -91,15 +98,13 @@ def __init__(

mission_space = MissionSpace(mission_func=self._gen_mission)

self.size = 25

if max_steps is None:
max_steps = maxNumRooms * 20

super().__init__(
mission_space=mission_space,
width=self.size,
height=self.size,
width=width,
height=height,
max_steps=max_steps,
**kwargs,
)
Expand Down

0 comments on commit 939ae21

Please sign in to comment.