':param rom_file: path to the rom
:param frame_skip: skip every k frames and repeat the action
:param image_shape: (w, h)
:param height_range: (h1, h2) to cut
:param viz: visualization to be done.
Set to 0 to disable.
Set to a positive number to be the delay between frames to show.
Set to a string to be a directory to store frames.
:param nullop_start: start with random number of null ops
:param live_losts_as_eoe: consider lost of lives as end of episode.  useful for training.'

def __init__(self, rom_file, viz=0, height_range=(None, None), frame_skip=4, image_shape=(84, 84), nullop_start=30, live_lost_as_eoe=True):

    super(AtariPlayer, self).__init__()
    if ((not os.path.isfile(rom_file)) and ('/' not in rom_file)):
        rom_file = get_dataset_path('atari_rom', rom_file)
    assert os.path.isfile(rom_file), 'rom    {}    not    found.    Please    download    at    {}'.format(rom_file, ROM_URL)
    try:
        ALEInterface.setLoggerMode(ALEInterface.Logger.Error)
    except AttributeError:
        if execute_only_once():
            logger.warn("You're    not    using    latest    ALE")
    with _ALE_LOCK:
        self.ale = ALEInterface()
        self.rng = get_rng(self)
        self.ale.setInt('random_seed', self.rng.randint(0, 30000))
        self.ale.setBool('showinfo', False)
        self.ale.setInt('frame_skip', 1)
        self.ale.setBool('color_averaging', False)
        self.ale.setFloat('repeat_action_probability', 0.0)
        if isinstance(viz, six.string_types):
            assert os.path.isdir(viz), viz
            self.ale.setString('record_screen_dir', viz)
            viz = 0
        if isinstance(viz, int):
            viz = float(viz)
        self.viz = viz
        if (self.viz and isinstance(self.viz, float)):
            self.windowname = os.path.basename(rom_file)
            cv2.startWindowThread()
            cv2.namedWindow(self.windowname)
        self.ale.loadROM(rom_file.encode('utf-8'))
    (self.width, self.height) = self.ale.getScreenDims()
    self.actions = self.ale.getMinimalActionSet()
    self.live_lost_as_eoe = live_lost_as_eoe
    self.frame_skip = frame_skip
    self.nullop_start = nullop_start
    self.height_range = height_range
    self.image_shape = image_shape
    self.current_episode_score = StatCounter()
    self.restart_episode()
