summaryrefslogtreecommitdiff
path: root/rl/gym_demo/hello.py
diff options
context:
space:
mode:
authorzhang <zch921005@126.com>2022-06-04 08:48:54 +0800
committerzhang <zch921005@126.com>2022-06-04 08:48:54 +0800
commit44097da7288042e988bcb89f1c6cc817a8e1eec9 (patch)
tree7c28da29f31ca429b8d27ed7441d650f1195812d /rl/gym_demo/hello.py
parent0f885b830ac552bfd357dec74c70e1349434b58b (diff)
0604
Diffstat (limited to 'rl/gym_demo/hello.py')
-rw-r--r--rl/gym_demo/hello.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/rl/gym_demo/hello.py b/rl/gym_demo/hello.py
new file mode 100644
index 0000000..766d2b3
--- /dev/null
+++ b/rl/gym_demo/hello.py
@@ -0,0 +1,10 @@
+
+import gym
+# 创建一个小车倒立摆模型
+env = gym.make('CartPole-v0')
+# 初始化环境
+env.reset()
+# 刷新当前环境,并显示
+for _ in range(1000):
+ env.render()
+ env.step(env.action_space.sample()) # take a random action \ No newline at end of file