Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. import gym
  2. import random
  3. import numpy as np
  4. import tflearn
  5. from tflearn.layers.core import input_data, dropout, fully_connected
  6. from tflearn.layers.estimator import regression
  7. from statistics import median, mean
  8. from collections import Counter
  9.  
  10. LR = 1e-3
  11. env = gym.make("Breakout-ram-v0")
  12. env.reset()
  13. goal_steps = 500
  14. score_requirement = 50
  15. initial_games = 10000
  16.  
  17.  
  18. def some_random_games_first():
  19. # Each of these is its own game.
  20. for episode in range(5):
  21. env.reset()
  22. # this is each frame, up to 200...but we wont make it that far.
  23. for t in range(200):
  24. # This will display the environment
  25. # Only display if you really want to see it.
  26. # Takes much longer to display it.
  27. env.render()
  28.  
  29. # This will just create a sample action in any environment.
  30. # In this environment, the action can be 0 or 1, which is left or right
  31. action = env.action_space.sample()
  32.  
  33. # this executes the environment with an action,
  34. # and returns the observation of the environment,
  35. # the reward, if the env is over, and other info.
  36. observation, reward, done, info = env.step(action)
  37. if done:
  38. break
  39.  
  40.  
  41. some_random_games_first()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement