@@ -126,6 +126,12 @@ def __init__(
126126 self .full_action_space = full_action_space
127127 self .continuous = continuous
128128 self .continuous_action_threshold = continuous_action_threshold
129+ self .map_action_idx = np .zeros ((3 , 3 , 2 ), dtype = np .int32 )
130+ for h in (- 1 , 0 , 1 ):
131+ for v in (- 1 , 0 , 1 ):
132+ for f in (0 , 1 ):
133+ action = AtariEnv .map_action_idx (h , v , bool (f )).value
134+ self .map_action_idx [h + 1 , v + 1 , f ] = action
129135 self .single_action_space , self .action_space = (
130136 self ._setup_continuous_action ()
131137 if self .continuous
@@ -141,12 +147,6 @@ def _setup_obs(self, stack_num: int, img_height: int, img_width: int) -> tuple:
141147 return single , gymnasium .vector .utils .batch_space (single , self .batch_size )
142148
143149 def _setup_continuous_action (self ) -> tuple :
144- self .map_action_idx = np .zeros ((3 , 3 , 2 ), dtype = np .int32 )
145- for h in (- 1 , 0 , 1 ):
146- for v in (- 1 , 0 , 1 ):
147- for f in (0 , 1 ):
148- action = AtariEnv .map_action_idx (h , v , bool (f )).value
149- self .map_action_idx [h + 1 , v + 1 , f ] = action
150150 # Actions are radius, theta, and fire, where first two are the parameters of polar coordinates.
151151 single = Box (
152152 low = np .array ([0.0 , - np .pi , 0.0 ]).astype (np .float32 ),
0 commit comments