In the previous section, we learned how to leverage deep Q-learning to solve the CartPole environment in Gym. In this section, we will work on a more complicated game of Pong and understand how deep Q-learning, alongside the fixed targets model, can solve the game. While working on this use case, you will also learn how to leverage a CNN-based model (in place of the vanilla neural network we used in the previous section) to solve the problem.
The objective of this use case is to build an agent that can play against a computer (a pre-trained, non-learning agent) and beat it in a game of Pong, where the agent is expected to achieve a score of 21 points.
The strategy that we will adopt to solve the problem of creating a successful agent for the game of Pong is as follows:
Crop the irrelevant portion of the image in order to fetch the current frame (state):
Note that, in the preceding image, we have taken the original image and cropped...