diff --git a/README.md b/README.md index d7422a5..965b429 100644 --- a/README.md +++ b/README.md @@ -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.