Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created July 20, 2019 10:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save NMZivkovic/2602d64e16991d3ef90ed5ce94bbcd4c to your computer and use it in GitHub Desktop.
Save NMZivkovic/2602d64e16991d3ef90ed5ce94bbcd4c to your computer and use it in GitHub Desktop.
total_epochs, total_penalties = 0, 0
num_of_episodes = 10
enviroment.reset()
counter = 0
for e in range(num_of_episodes):
state = enviroment.reset()
state = img_processor.process_env_state(state)
epochs = 0
penalties = 0
reward = 0
total_reward = 0
terminated = False
for timesteps in tqdm(range(timesteps_per_episode)):
action = agent.act(state)
state, reward, terminated, info = enviroment.step(action)
state = img_processor.process_env_state(state)
if reward == -10:
penalties += 1
total_reward += reward
epochs += 1
img_processor.save_frame("images/frame_{}.png".format(counter))
counter += 1
total_penalties += penalties
total_epochs += epochs
img_processor.makegif("images/")
print("**********************************")
print("Done!")
print("**********************************")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment