Trying to understand how to build and train neural network based AI for games, and struggling to get some details straight.
Not even concerned yet with whether to use TensorFlow or something else or build my own. First I'm trying to grasp some basics such as what ranges to use, e.g. inputs between -1 and 1 or between 0 and 1, or how to represent input game situations and output moves.
Suppose I'm building a neural network to play Connect Four. Given a game situation, the AI is to generate an 'optimal move'. Let's say the optimal move is the move with the highest probability of eventually winning the game, assuming a reasonably smart opponent.
I guess the input would be 7 columns * 6 rows = 42 input neurons, each containing a value that represents either my color, or the opponent's color, or empty. How do I encode this? Does it make a difference whether I use:
- 0 = empty, 1 = my piece, 2 = opponent's piece
- 0 = empty, 0.5 = my piece, 1 = opponent's piece
- 0 = empty, 1 = my piece, -1 = opponent's piece
Or should I even use two times 42 = 84 input neurons, all binary/boolean, where 0=empty, 1s in the first 42 neurons represent my pieces, and 1s in the second 42 neurons represent the opponent's pieces?
What does the output look like? 7 neurons that each represent one column, getting an output value in the 0..1 range, and the AI's move would be the one with the highest value? Or just one output value ranging from 0 to 1, where roughly each 1/7th of the interval represents a particular column?
Also, how should I design my neural network, how many hidden layers? Classification or regression? Sigmoid or Relu or tanh as activation function?
Intuitively, based on my limited experience with neural networks, I would say 2 or 3 hidden layers, each with two times the number of input neurons. No idea about the other considerations, I would just make stabs in the dark and trial and error.
Any feedback or suggestions to get me in the right direction?