mirror of
https://github.com/Farama-Foundation/Gymnasium.git
synced 2025-08-22 07:02:19 +00:00
@@ -21,3 +21,5 @@ class Discrete(Space):
|
|||||||
return "Discrete(%d)" % self.n
|
return "Discrete(%d)" % self.n
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.n == other.n
|
return self.n == other.n
|
||||||
|
def __len__(self):
|
||||||
|
return n
|
||||||
|
@@ -7,6 +7,9 @@ class Tuple(Space):
|
|||||||
def __init__(self, spaces):
|
def __init__(self, spaces):
|
||||||
self.spaces = spaces
|
self.spaces = spaces
|
||||||
|
|
||||||
|
def __len__(self):
|
||||||
|
return len(self.spaces)
|
||||||
|
|
||||||
def sample(self):
|
def sample(self):
|
||||||
return tuple([space.sample() for space in self.spaces])
|
return tuple([space.sample() for space in self.spaces])
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user