forked from Farama-Foundation/Minigrid
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathempty.py
76 lines (53 loc) · 1.69 KB
/
empty.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# -*- coding: utf-8 -*-
from ..minigrid import *
from ..register import register
class SimpleEmptyEnv(SimpleMiniGridEnv):
def __init__(self, grid_size):
super().__init__(grid_size=grid_size)
def reset(self):
# Step count since episode start
self.step_count = 0
# Create grid
self.create_grid(self.width, self.height)
self.create_outer_wall()
# Select a random initial state and goal
self.reset_state_goal()
# Add goal
self.goals = list()
self.add_goal(self.goal_pos)
return self.state, self.goal_pos
class SimpleEmptyEnv5x5(SimpleEmptyEnv):
def __init__(self):
super().__init__(grid_size=5)
class SimpleEmptyEnv10x10(SimpleEmptyEnv):
def __init__(self):
super().__init__(grid_size=10)
class SimpleEmptyEnv15x15(SimpleEmptyEnv):
def __init__(self):
super().__init__(grid_size=15)
class SimpleEmptyEnv20x20(SimpleEmptyEnv):
def __init__(self):
super().__init__(grid_size=20)
class SimpleEmptyEnv25x25(SimpleEmptyEnv):
def __init__(self):
super().__init__(grid_size=25)
register(
_id='Simple-MiniGrid-Empty-5x5-v0',
entry_point='gym_simple_minigrid.envs:SimpleEmptyEnv5x5'
)
register(
_id='Simple-MiniGrid-Empty-10x10-v0',
entry_point='gym_simple_minigrid.envs:SimpleEmptyEnv10x10'
)
register(
_id='Simple-MiniGrid-Empty-15x15-v0',
entry_point='gym_simple_minigrid.envs:SimpleEmptyEnv15x15'
)
register(
_id='Simple-MiniGrid-Empty-20x20-v0',
entry_point='gym_simple_minigrid.envs:SimpleEmptyEnv20x20'
)
register(
_id='Simple-MiniGrid-Empty-25x25-v0',
entry_point='gym_simple_minigrid.envs:SimpleEmptyEnv25x25'
)