The first step in the project is to create a Brain class containing all the neural network code in order to compute a Q-value approximation. The class will contain the necessary initialization, the code for creating a suitable TensorFlow graph for the purpose, a simple neural network (not a complex deep learning architecture but a simple, working network for our project—you can replace it with more complex architectures), and finally, methods for fit and predict operations.
We start from initialization. As inputs, first, we really need to know the size of the state inputs (nS) corresponding to the information we receive from the game, and the size of the action output (nA) corresponding to the buttons we can press to ...