To show how adaptable neural networks can be, we will now attempt to use a neural network in order to learn the optimal moves for Tic Tac Toe. We will approach this knowing that Tic Tac Toe is a deterministic game and that the optimal moves are already known.

# Learning to play Tic Tac Toe

# Getting ready

To train our model, we will use a list of board positions followed by the best optimal response for a number of different boards. We can reduce the amount of boards to train on by considering only board positions that are different with regard to symmetry. The non-identity transformations of a Tic Tac Toe board are a rotation (in either direction) of 90 degrees, 180 degrees, and 270 degrees, a horizontal reflection, and a vertical...