示例#1
0
    def __init__(self, rom_file, random_seed, frame_skip, repeat_action_probability, minimum_actions, use_sdl,
                 test_mode, image_processing=None):
        ALEInterface.__init__(self)
        # Set USE_SDL to true to display the screen. ALE must be compilied
        # with SDL enabled for this to work. On OSX, pygame init is used to
        # proxy-call SDL_main.
        if use_sdl:
            if sys.platform == 'darwin':
                import pygame
                pygame.init()
                self.setBool('sound', False)  # Sound doesn't work on OSX
            elif sys.platform.startswith('linux'):
                self.setBool('sound', True)
                self.setBool('display_screen', True)

        self.setFloat('repeat_action_probability', repeat_action_probability)
        self.setInt('frame_skip', frame_skip)

        self.random_seed = random_seed
        self.frame_skip = frame_skip # trolololo
        self.minimum_actions = minimum_actions
        self.test_mode = test_mode
        self.image_processing = image_processing
        self.num_actions = 0
        self.legal_actions = []
        self.queue = deque()
        self.height = -1
        self.width = -1

        self.loadROM(rom_file)

        height, width = self.getScreenDims()
        logging.info('Screen resolution is %dx%d' % (height, width))