The other part of the emulator is the gym Atari simulator:
def start_game(queue): atari = gym.make('Breakout-v0') key_to_act = atari.env.get_keys_to_action() key_to_act = {k[0]: a for k, a in key_to_act.items() if len(k) > 0} observation = atari.reset() import numpy from PIL import Image img = numpy.dot(observation, [0.2126, 0.7152, 0.0722]) img = cv2_resize_image(img) img = Image.fromarray(img) img.save('save/{}.jpg'.format(0)) while True: atari.render() action = 0 if queue.empty() else queue.get(block=False) if action == -1: break action = key_to_act.get(action, 0) observation, reward, done, _ = atari.step(action) if action != 0: print("Action {}, reward {}".format(action, reward)) if done: print("Game finished") ...