""import gym import random random seed( make results reproducible num_episodes def main()env gym make('spaceinvaders- 'env seed( create the game make results reproducible rewards [for in range(num_episodes)env reset(episode_reward while trueaction env action_space sample(_rewarddone_ env step(actionrandom action episode_reward +reward if doneprint('reward%depisode_rewardrewards append(episode_rewardbreak print('average reward (sum(rewardslen(rewards))