Delete prng.py (#1196)

* Delete prng.py

Since it seems like this seeding function is rarely used.

* Update __init__.py

* Update kellycoinflip.py

* Update core.py

* Update box.py

* Update discrete.py

* Update multi_binary.py

* Update multi_discrete.py

* Update test_determinism.py

* Update test_determinism.py

* Update test_determinism.py

* Update core.py

* Update box.py

* Update test_determinism.py

* Update core.py

* Update box.py

* Update discrete.py

* Update multi_binary.py

* Update multi_discrete.py

* Update dict_space.py

* Update tuple_space.py

* Update core.py

* Create space.py

* Update __init__.py

* Update __init__.py

* Update box.py

* Update dict_space.py

* Update discrete.py

* Update dict_space.py

* Update multi_binary.py

* Update multi_discrete.py

* Update tuple_space.py

* Update discrete.py

* Update box.py

* Update dict_space.py

* Update multi_binary.py

* Update multi_discrete.py

* Update tuple_space.py

* Update multi_discrete.py

* Update multi_binary.py

* Update dict_space.py

* Update box.py

* Update test_determinism.py

* Update kellycoinflip.py

* Update space.py
This commit is contained in:
Xingdong Zuo
2019-01-30 22:39:55 +01:00
committed by pzhokhov
parent 8c3afcf8e3
commit 6497c9f1c6
12 changed files with 104 additions and 88 deletions

View File

@@ -1,13 +1,19 @@
import gym
import numpy as np
from .space import Space
class MultiBinary(gym.Space):
class MultiBinary(Space):
def __init__(self, n):
self.n = n
gym.Space.__init__(self, (self.n,), np.int8)
super().__init__((self.n,), np.int8)
self.np_random = np.random.RandomState()
def seed(self, seed):
self.np_random.seed(seed)
def sample(self):
return gym.spaces.np_random.randint(low=0, high=2, size=self.n).astype(self.dtype)
return self.np_random.randint(low=0, high=2, size=self.n).astype(self.dtype)
def contains(self, x):
return ((x==0) | (x==1)).all()