# Representing inputs and outputs for a card game neural network

I'm attempting to create an AI for a card game using reinforcement learning. The basics of the game are that you can have (theoretically) up to 35 cards in your hand, you can also have to up to 35 cards 'in play' and so can your opponent. In normal play you would have ~6 cards in your hand and maybe ~3 each in play. There are roughly 300 unique cards in total.

How should I represent the game state for the input and how should I represent the action to take in the output?

• Would love to know about the output if u found ur answer! – Haytam Jul 7 '18 at 17:31
• There is room for more detail here that might help get a more precise answer. If there are 300 unique cards, are any repeated (and what is maximum number of each)? Are they complex rules-carrying cards (e.g. Magic the Gathering)? Are card combinations used in a "play" bound by simple or complex rules (a simple rule might be "same suit", or "each card must relate to something already in play")? When you say in "each play", is that actually an atomic action - e.g. all 3 at once - or a sequence of cards during your turn "I play a Foo, then modify it with this Bar, then also change X with this Y" – Neil Slater Aug 9 '18 at 16:05

## 1 Answer

Assuming there's no ordering to the hand (i.e. it doesn't matter what order cards were added to it), then a reasonable approach is to use one input neuron for the number of each kind of card that is present in a player's hand.

You don't describe how the game is played, but a common approach for extracting actions is to have one output neuron for each possible action. To select an action, you would pick the one corresponding to the neuron with the highest output response to a given input.