2626from malmoenv import comms
2727from malmoenv .commands import CommandParser
2828import uuid
29- import gym .spaces
29+ import gymnasium .spaces
3030from malmoenv .comms import retry
3131from malmoenv .version import malmo_version
3232
3333
34- class StringActionSpace (gym .spaces .Discrete ):
34+ class StringActionSpace (gymnasium .spaces .Discrete ):
3535 """Malmo actions as their strings."""
3636 def __init__ (self ):
37- gym .spaces .Discrete .__init__ (self , 1 )
37+ gymnasium .spaces .Discrete .__init__ (self , 1 )
3838
3939 def __getitem__ (self , action ):
4040 return action
4141
4242
43- class ActionSpace (gym .spaces .Discrete ):
43+ class ActionSpace (gymnasium .spaces .Discrete ):
4444 """Malmo actions as gym action space"""
4545 def __init__ (self , actions ):
4646 self .actions = actions
47- gym .spaces .Discrete .__init__ (self , len (self .actions ))
47+ gymnasium .spaces .Discrete .__init__ (self , len (self .actions ))
4848
4949 def sample (self ):
5050 return random .randint (1 , len (self .actions )) - 1
@@ -56,12 +56,12 @@ def __len__(self):
5656 return len (self .actions )
5757
5858
59- class VisualObservationSpace (gym .spaces .Box ):
59+ class VisualObservationSpace (gymnasium .spaces .Box ):
6060 """Space for visual observations: width x height x depth as a flat array.
6161 Where depth is 3 or 4 if encoding scene depth.
6262 """
6363 def __init__ (self , width , height , depth ):
64- gym .spaces .Box .__init__ (self ,
64+ gymnasium .spaces .Box .__init__ (self ,
6565 low = np .iinfo (np .uint8 ).min , high = np .iinfo (np .uint8 ).max ,
6666 shape = (height , width , depth ), dtype = np .uint8 )
6767
0 commit comments