<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> from random import randrange <EOL> from ale_python_interface import ALEInterface <EOL> def get_random_baseline ( gamepath ) : <EOL> ale = ALEInterface ( ) <EOL> ale . setInt ( '<STR_LIT>' , <NUM_LIT> ) <EOL> recordings_dir = '<STR_LIT>' <EOL> USE_SDL = True <EOL> if USE_SDL : <EOL> if sys . platform == '<STR_LIT>' : <EOL> import pygame <EOL> pygame . init ( ) <EOL> ale . setBool ( '<STR_LIT>' , False ) <EOL> elif sys . platform . startswith ( '<STR_LIT>' ) : <EOL> ale . setBool ( '<STR_LIT>' , True ) <EOL> ale . setBool ( '<STR_LIT>' , True ) <EOL> ale . loadROM ( gamepath ) <EOL> legal_actions = ale . getLegalActionSet ( ) <EOL> rewards = [ ] <EOL> for episode in xrange ( <NUM_LIT:10> ) : <EOL> total_reward = <NUM_LIT:0> <EOL> while not ale . game_over ( ) : <EOL> a = legal_actions [ randrange ( len ( legal_actions ) ) ] <EOL> reward = ale . act ( a ) ; <EOL> total_reward += reward <EOL> rewards . append ( total_reward ) <EOL> ale . reset_game ( ) <EOL> avg_reward = sum ( rewards ) / float ( len ( rewards ) ) <EOL> return avg_reward <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> base_dir = '<STR_LIT>' <EOL> games = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' ] <EOL> baselines = [ ] <EOL> for game in games : <EOL> gamepath = os . path . join ( base_dir , game ) <EOL> baseline = get_random_baseline ( gamepath ) <EOL> baselines . append ( baseline ) <EOL> print ( '<STR_LIT:\n>' ) <EOL> for game , baseline in zip ( games , baselines ) : <EOL> print ( '<STR_LIT>' . format ( game , baseline ) ) </s>
