import gym import random def main()env gym make('spaceinvaders- 'env reset(nextadd an env step function this function can return the following kinds of valuesstatethe new state of the gameafter applying the provided action rewardthe increase in score that the state incurs by way of examplethis could be when bullet has destroyed an alienand the score increases by points thenreward in playing any score-based gamethe player' goal is to maximize the score this is synonymous with maximizing the total reward donewhether or not the episode has endedwhich usually occurs when player has lost all lives infoextraneous information that you'll put aside for now you will use reward to count your total reward you'll also use done to determine when the player dieswhich will be when done returns true add the following game loopwhich instructs the game to loop until the player dies