# -*- coding: utf-8 -*-
"""
Exemple d'utilisation de CartPole dans l'environnement gym
"""

import gym
env = gym.make('CartPole-v0')
for i_episode in range(5):
    observation = env.reset()
    for t in range(100):
        env.render()
        print(observation)
        action = env.action_space.sample()
        observation, reward, done, info = env.step(action)
        if done:
            print("Épisode terminé après {} étapes".format(t+1))
            break
env.close()
a4b2a8bf83c890c134796b833b1c364f8f53901e
<mask token>

<mask token>
for i_episode in range(5):
    observation = env.reset()
    for t in range(100):
        env.render()
        print(observation)
        action = env.action_space.sample()
        observation, reward, done, info = env.step(action)
        if done:
            print('Épisode terminé après {} étapes'.format(t + 1))
            break
env.close()

<mask token>
env = gym.make('CartPole-v0')
for i_episode in range(5):
    observation = env.reset()
    for t in range(100):
        env.render()
        print(observation)
        action = env.action_space.sample()
        observation, reward, done, info = env.step(action)
        if done:
            print('Épisode terminé après {} étapes'.format(t + 1))
            break
env.close()

<mask token>
import gym
env = gym.make('CartPole-v0')
for i_episode in range(5):
    observation = env.reset()
    for t in range(100):
        env.render()
        print(observation)
        action = env.action_space.sample()
        observation, reward, done, info = env.step(action)
        if done:
            print('Épisode terminé après {} étapes'.format(t + 1))
            break
env.close()

# -*- coding: utf-8 -*-
"""
Exemple d'utilisation de CartPole dans l'environnement gym
"""

import gym
env = gym.make('CartPole-v0')
for i_episode in range(5):
    observation = env.reset()
    for t in range(100):
        env.render()
        print(observation)
        action = env.action_space.sample()
        observation, reward, done, info = env.step(action)
        if done:
            print("Épisode terminé après {} étapes".format(t+1))
            break
env.close()