INNER CODE UNIT · Python
Discrete
maxpumperla/learning_ray · notebooks/maze_gym_env.py:6
class Discrete:
def __init__(self, num_actions: int):
""" Discrete action space for num_actions.
Discrete(4) can be used as encoding moving in one of the cardinal directions.
"""
self.n = num_actions
def sample(self):
return random.randint(0, self.n - 1)
class Environment:
seeker, goal = (0, 0), (4, 4)
info = {'seeker': seeker, 'goal': goal}
def __init__(self, *args, **kwargs):
self.action_space = Discrete(4)