From 07e68108ec6eb4df1b0e84b84048db8ccddd2b4b Mon Sep 17 00:00:00 2001 From: KRZYSZTOF RUDNICKI Date: Fri, 4 Oct 2024 14:31:22 +0200 Subject: [PATCH] feat: hello world open ai gymnasium --- .gitignore | 1 + README.md | 6 +++++- main.py | 11 +++++++++++ requirements.txt | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 main.py create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 82f92755..0417715d 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,4 @@ cython_debug/ # 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. #.idea/ +lectures \ No newline at end of file diff --git a/README.md b/README.md index 980e0a93..631e4e82 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# USD \ No newline at end of file +# USD + +Install swig, python and pip +Install libraries required by program: +`pip install -r requirements.txt` \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 00000000..a724c66f --- /dev/null +++ b/main.py @@ -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() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..426012ee --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +gymnasium +gymnasium[box2d] \ No newline at end of file