After learning the basics of neural networks and coding one working with the MNIST dataset, I wanted to go to the next step by making one which is able to play a game. I wanted to make it work on a game like slither.io. So, in order to be able to create multiple instances of snakes and accelerate the speed of the game, I recreated a simple version of the game:
The core features being almost done, now comes the work on the AI. I want to keep the script very simple by using only NumPy (not that TensorFlow, PyTorch, or Spark does not interest me, but I want to understand things at a "low level" before using those frameworks).
At first, I wanted the AI to be able to propose an output by reading pixels. But after some research, I don't really want to get into convnet, recurrent, and recursive neural net. I'd like to re-use the simple feed-forward NN I did with MNIST and adapt it.
So, instead of using pixels, I think I'm going to use the following data:
- {x,y} snake's position
- {x,y} foods positions
- food value
- Time, in order to get the snake, eat more food in a short time.
- Distance from the center, not die outside the area
That's a lot of different data to handle!
My questions
- Can a simple FNN handle different kinds of data in the input layer?
- Will it properly work with a variable number of inputs?
In fact, in a specific area around the snake, the quantity of food will be variable. I came across this post, which kinda answers my question, but what if I want the neural network to forget some input if they are not being used, can dropout be of any use in this case. Or the value of the weights (correcting toward zero) of these inputs will be enough?