Skip to content

Commit

Permalink
Update readme quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
Maximilian Weichart committed Sep 11, 2024
1 parent 3304510 commit 5ab7083
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,23 @@ Getting started with Tetris Gymnasium is straightforward. Here's an example to r
actions:

```python
import cv2
import gymnasium as gym

from tetris_gymnasium.envs.tetris import Tetris

env = gym.make("tetris_gymnasium/Tetris", render_mode="human")
env.reset(seed=42)
if __name__ == "__main__":
env = gym.make("tetris_gymnasium/Tetris", render_mode="human")
env.reset(seed=42)

terminated = False
while not terminated:
env.render()
action = env.action_space.sample()
observation, reward, terminated, truncated, info = env.step(action)
key = cv2.waitKey(100) # timeout to see the movement
print("Game Over!")

terminated = False
while not terminated:
env.render()
action = env.action_space.sample()
observation, reward, terminated, truncated, info = env.step(action)
print("Game Over!")
```

For more examples, e.g. training a DQN agent, please refer to the [examples](examples) directory.
Expand Down

0 comments on commit 5ab7083

Please sign in to comment.