I'm trying to train a neural network-based model to play a game similar to Pac-Man, except there's no maze. i.e., the player is in a 2-dimensional grid, with dots of food in some locations, and the player need to figure out walking to the cells with the food.

I'd like the player to only see the 11x11 cells around him, i.e. an array of 11x11 cells, with our player in the center, and either a food or no food in each cell.

I tried feeding that array as-is as input to my neural network, but it's learning poorly. This makes sense, as this smells like a problem that you'd use convolution layers for, because this array is kind of like an image.

But unlike an image, we don't care about contours at all. Unlike an image, the 2 cells to the left and right of the centermost cell have vastly different meanings: The position on the left and the right of the player. Food in the former should encourage going to the left, and food on the latter should encourage going to the right. Not so with any similarly-spaced cells in the input. Therefore I'm not seeing how CNN would be a good fit.

Can you think of a good way to represent this input to a neural network?

  • 1
    $\begingroup$ Can you share your code on how you currently represent the input space? $\endgroup$ Sep 22, 2020 at 14:09

1 Answer 1


A grid of cells can be inputed into a neural network as a matrix. A matrix is a common input shape for a Convolutional Neural Network (CNN).

It is generally useful to pick a simple representation of the input and pick a representation that is common to other deep learning problems.

Representing the input in an amenable way for deep learning is only one issue in the entire workflow. Since you are training a game-like agent, representing potential future actions relative to the input space will also be challenging.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.