예제 #1
0
    # 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("")

    except KeyboardInterrupt:
        print("Stopped")