Playing breakout

The Atari games can be played in several ways. The first is the interaction way. Either we can use a memory view, or we can use the displayed image (which is always the same). On top of this, the -v? at the end of the name of the game indicates if the step is repeated and how often. v0 for breakout indicates that the step is taken two, three, or four times before we ask for a new one. For v4, it skips four frames deterministically.

We can start with an empty, simple breakout game:

# Import the gym moduleimport gym# Create a breakout environmentenv = gym.make('BreakoutDeterministic-v4')# Reset it, returns the starting frameframe = env.reset()# Renderenv.render()is_done = Falsewhile not is_done: # Perform a random action, returns ...

Get Building Machine Learning Systems with Python - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.