nickmar commited on
Commit
d6d3c83
·
verified ·
1 Parent(s): f1f1d59

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +23 -3
README.md CHANGED
@@ -30,8 +30,28 @@ TODO: Add your code
30
 
31
 
32
  ```python
33
- from stable_baselines3 import ...
34
- from huggingface_sb3 import load_from_hub
35
 
36
- ...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  ```
 
30
 
31
 
32
  ```python
33
+ import gymnasium as gym
 
34
 
35
+ # First, we create our environment called LunarLander-v2
36
+ env = gym.make("LunarLander-v2")
37
+
38
+ # Then we reset this environment
39
+ observation, info = env.reset()
40
+
41
+ for _ in range(20):
42
+ # Take a random action
43
+ action = env.action_space.sample()
44
+ print("Action taken:", action)
45
+
46
+ # Do this action in the environment and get
47
+ # next_state, reward, terminated, truncated and info
48
+ observation, reward, terminated, truncated, info = env.step(action)
49
+
50
+ # If the game is terminated (in our case we land, crashed) or truncated (timeout)
51
+ if terminated or truncated:
52
+ # Reset the environment
53
+ print("Environment is reset")
54
+ observation, info = env.reset()
55
+
56
+ env.close()
57
  ```