Closed MarcCote closed 4 years ago
Thanks for this PR! I like the changes except for the side effect of having seed() reset the game. How would you feel about having a seed method with a small note that reset() needs to be called for the seed to take effect?
def seed(self, seed=None):
'''
Sets the random seed used by the emulator.
:param seed: The random seed. The default of `None` will use the seed \
from the game's walkthrough. A value of `-1` will seed to time.
:type seed: Int
:returns: The value of the random seed.
.. note:: :meth:`jericho.FrotzEnv.reset()` must be called before the seed takes effect.
'''
seed = seed or self.bindings.get('seed', -1)
self._seed = seed
return seed
This PR adds the
seed
method toFrotzEnv
that allows changing seed without creating a new instance ofFrotzEnv
.NB: the default seed is the one from the bindings (i.e. the walkthrough) if it exists. Otherwise, the value -1 is used.