Files
easy-rl/codes/PolicyGradient/env.py
2020-11-27 18:34:11 +08:00

19 lines
468 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python
# coding=utf-8
'''
Author: John
Email: johnjim0816@gmail.com
Date: 2020-11-22 23:23:10
LastEditor: John
LastEditTime: 2020-11-23 11:55:24
Discription:
Environment:
'''
import gym
def env_init():
env = gym.make('CartPole-v0') # 可google为什么unwrapped gym此处一般不需要
env.seed(1) # 设置env随机种子
state_dim = env.observation_space.shape[0]
n_actions = env.action_space.n
return env,state_dim,n_actions