Now, let us see how to make use of the DRQN algorithm to train our agent to play Doom. We assign positive rewards for successfully killing the monsters and negative rewards for losing life, suicide, and losing ammo (bullets). You can get the complete code as a Jupyter notebook with the explanation at https://github.com/sudharsan13296/Hands-On-Reinforcement-Learning-With-Python/blob/master/09.%20Playing%20Doom%20Game%20using%20DRQN/9.5%20Doom%20Game%20Using%20DRQN.ipynb. The credits for the code used in this section go to Luthanicus (https://github.com/Luthanicus/losaltoshackathon-drqn).
First, let us import all the necessary libraries:
import tensorflow as tfimport numpy as npimport matplotlib.pyplot as pltfrom vizdoom import ...