from open_source.rlpyt.rlpyt.samplers.serial.sampler import SerialSampler
from open_source.rlpyt.rlpyt.envs.gym import make as gym_make
from open_source.rlpyt.rlpyt.algos.qpg.sac import SAC
from open_source.rlpyt.rlpyt.agents.qpg.sac_agent import SacAgent
from open_source.rlpyt.rlpyt.runners.minibatch_rl import MinibatchRlEval
from open_source.rlpyt.rlpyt.utils.logging.context import logger_context
from open_source.rlpyt.rlpyt.algos.qpg.ddpg import *
from open_source.rlpyt.rlpyt.agents.qpg.ddpg_agent import *
import datetime

import gym
env = gym.make('Pendulum-v0')
for i_episode in range(1):
    observation = env.reset()
    for t in range(1000):
        env.render()
        action = env.action_space.sample()
        observation, reward, done, info = env.step(action)
        print("observation={obs}, reward={r}".format(obs=observation,r=reward))
        if done:
            print("Episode finished after {} timesteps".format(t+1))
            break
env.close()
print(env.action_space)
print(env.observation_space)