def followPath(policy, start, numSteps=100):
    state = start
    path = []
    for i in range(numSteps):
        if state not in policy:
            break
        action = policy[state]
        path.append("(%s,%s)" % state)
        if action == 'north':
            nextState = state[0], state[1] + 1
        if action == 'south':
            nextState = state[0], state[1] - 1
        if action == 'east':
            nextState = state[0] + 1, state[1]
        if action == 'west':
            nextState = state[0] - 1, state[1]
        if action == 'exit' or action is None:
            path.append('TERMINAL_STATE')
            break
        state = nextState

    return path
dataset/ETHPy150Open rlpy/rlpy/rlpy/Domains/PacmanPackage/reinforcementTestClasses.py/followPath/original