Add a feature to generate a white noise background as init world
This commit is contained in:
parent
6f004245f3
commit
8c6f2c78d9
1 changed files with 5 additions and 0 deletions
|
|
@ -85,6 +85,11 @@ class World(object):
|
||||||
self._val = np.zeros([self._y, self._x])
|
self._val = np.zeros([self._y, self._x])
|
||||||
else:
|
else:
|
||||||
self._val = np.zeros([self._y, self._x, 3])
|
self._val = np.zeros([self._y, self._x, 3])
|
||||||
|
elif color == 'rand':
|
||||||
|
if self._gray:
|
||||||
|
self._val = np.random.randint(255, size=(self._y, self._x))
|
||||||
|
else:
|
||||||
|
self._val = np.random.randint(255, size=(self._y, self._x, 3))
|
||||||
else:
|
else:
|
||||||
self._val = [[color for _ in range(self._x)] for _ in range(self._y)]
|
self._val = [[color for _ in range(self._x)] for _ in range(self._y)]
|
||||||
self._val = np.array(self._val)
|
self._val = np.array(self._val)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue