Example #1
0
>>>>>>> a7a19c68ba9116d31ce4ce6aa41b78dcd515d250

    # specify which agent you want to use,
    # BonsaiAgent that uses trained Brain or
    # RandomAgent that randomly selects next action
    agent = BonsaiAgent()

    # hopper._env.render()
    # hopper._env.reset()

    episode_count = 100

    try:
        for i in range(episode_count):
            # start a new episode and get the new state
            hopper.episode_start()
            state = hopper.get_state()

            while True:
                # get the action from the agent (based on the current state)
                action = agent.act(state)
                hopper._env.unwrapped.camera_adjust()

            # do the next step of the simulation and get the new state
                hopper.episode_step(action)
                state = hopper.get_state()

                if hopper.halted():
                    break

            hopper.episode_finish("")