-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecord.py
More file actions
36 lines (30 loc) · 932 Bytes
/
record.py
File metadata and controls
36 lines (30 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gym
import gym.utils.play as gp
# import numpy as np
# import time
# import keyboard
def callback(prev_obs, obs, action, rew, env_done, info):
if not env_done:
data_tuple = (prev_obs,obs,action,rew)
game_data.append(data_tuple)
game_data = list()
gp.play(gym.make('BreakoutNoFrameskip-v4'),fps=20,zoom=3,callback=callback)
# exit()
# env = gym.make('BreakoutNoFrameskip-v4')
# for episode in range(10):
# print("Episode" + str(episode) + "Done")
# env.reset()
# for _ in range(1000):
# env.render(mode='human')
# action = 0
# if keyboard.is_pressed('s'):
# action = 1
# elif keyboard.is_pressed('a'):
# action = 3
# elif keyboard.is_pressed('d'):
# action = 2
# observation, reward, done, info = env.step(action)
# # time.sleep(0.2)
# if done:
# break
# print(reward)