mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-06 20:43:11 +02:00
feat: hello world open ai gymnasium
This commit is contained in:
parent
d6dd0abd79
commit
07e68108ec
1
.gitignore
vendored
1
.gitignore
vendored
@ -160,3 +160,4 @@ cython_debug/
|
|||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
lectures
|
||||||
@ -1 +1,5 @@
|
|||||||
# USD
|
# USD
|
||||||
|
|
||||||
|
Install swig, python and pip
|
||||||
|
Install libraries required by program:
|
||||||
|
`pip install -r requirements.txt`
|
||||||
11
main.py
Normal file
11
main.py
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import gymnasium as gym
|
||||||
|
env = gym.make("LunarLander-v2", render_mode="human")
|
||||||
|
observation, info = env.reset(seed=42)
|
||||||
|
for _ in range(1000):
|
||||||
|
action = env.action_space.sample() # this is where you would insert your policy
|
||||||
|
observation, reward, terminated, truncated, info = env.step(action)
|
||||||
|
|
||||||
|
if terminated or truncated:
|
||||||
|
observation, info = env.reset()
|
||||||
|
|
||||||
|
env.close()
|
||||||
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
gymnasium
|
||||||
|
gymnasium[box2d]
|
||||||
Loading…
Reference in New Issue
Block a user