# How to encode card game state into neural network input

I'm trying create neural network to predict moves in a card game. I am looking for recommendations on encoding the game state to my input layer. It's a complex turn based collectible card game (think Magic the Gathering). I need to represent cards being in various areas of the game board (deck, discard pile, hand, etc). It seems difficult to assign cards to these areas because the number of cards in these areas is never constant.

I was thinking of an approach where I assign each card in the game to being in a specific card area. The number of total cards in the game should be constant (let's assume that). This approach I feel should give me a potentially less sparse input.

Also, With this approach what is the best way to handle card duplicates? Let's say I have 3 copies of the exact same card in my deck. Maybe 1 of the copies is in my hand and 2 in my discard pile. It does not matter which of the 3 copies is in my hand because they are all the same exact card. There is now multiple ways to represent this same exact game state in my network because each individual card has it's own state. To me this does not seem good. How much will this effect my neural network's ability to learn the game?

We can think of game state as a column vector of the form $$1Xn$$. In this case, you can formalize cards held according to some encoding. This can be anything from a Gödel Numbering to simple integer assignment. Here is an example for poker in python: https://pypi.org/project/treys/