Using the file

We will first code the file. This requires the following steps:

  1. Import the necessary packages: We will import the required packages as follows:
import gymimport itertoolsimport numpy as npimport osimport randomimport sysimport matplotlib.pyplot as pltimport tensorflow as tffrom collections import deque, namedtuplefrom model import *from funcs import *
  1. Set the game and choose the valid actions: We will then set the game. Let's choose the BreakoutDeterministic-v4 game for now, which is a later version of Breakout v0. This game has four actions, numbered zero to three, and they represent 0: no-operation (noop), 1: fire, 2: move left, and 3: move right:
GAME = "BreakoutDeterministic-v4" # "BreakoutDeterministic-v0" ...

Get TensorFlow Reinforcement Learning Quick Start Guide 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.