Implementing the Space Invaders gaming bot

In this section, we will be coding the Space Invaders game using DQN and Q-learning. For coding, we will be using the gym, TensorFlow, and virtualenv libraries. You can refer to the entire code by using this GitHub link: https://github.com/jalajthanaki/SpaceInvaders_gamingbot.

We are using a convolutional neural network (CNN). Here, we have defined the CNN in a separate file. The name of this file is convnet.py. Take a look at the following screenshot: at the following figure:

Implementing the Space Invaders gaming bot

Figure 11.16: Code snippet for Convnrt.py

You can refer to the code using this GitHub link: https://github.com/jalajthanaki/SpaceInvaders_gamingbot/blob/master/convnet.py ...

Get Machine Learning Solutions 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.