-3

I have a simple implementation of a simple game in Python.

The Game has simple rules:

  • 2 Players play against each other
  • Every player has 10 cards
  • Each round the players play a card simultaneously
  • The Player who played a higher card wins the round
  • When there are no cards left the Player with the most won rounds wins the game

Now I wanted to build an AI using a Neural Network

There is an init-Function, a chooseMove-Function (here you can see the enemies last played Card) and a gameOver-Function (here you can see the result of the game)

Now my question is:

-> How do I approach this? Do I build different Networks for the different moves (1. move, 2. move, ....) or one for everything? What would I define as input and output and how do I tell the network what's a win and what's a loss?

And do I already do some thinking for the network? (E.g. it's good when you win the round that the difference between your card and the enemies card is very small but if you loose the round the difference should be very big)

I know these are all very basic questions and maybe it shows that my understanding of NN's is not really good but I thought that this might help me understand the Basics of NN's.

greece57
  • 421
  • 1
  • 6
  • 16

1 Answers1

1

Neural networks can be used for classification and some of them for regression. If you want to experiment with an NN you need to present a problem in a format that fits the above description. Furthermore NNs are typically work with fixed length vectors as input, so handling the different rounds of your game would be a problem. Actually your simple game is very complicated for a NN. If you prefer to go ahead you would need to:

  1. Define the problem as a classification or a choosing way. e.g. The program need to choose which card to play from a given hand.
  2. Normalize your data to fixed length vector.
  3. Get training data e.g. recordings of games in a database format
  4. Create your NN
  5. Train your NN using the recoded games

Each points above are complex topics and several hundreds of pages could be written about each of them.

May I propose another option to start with if you want something simple: Writing a NN that decides if a poker player should fold in the beginning or join the game is much closer to a typical NN problem. Your input is 2 cards and the size of the poker table (6 or 10) to keep it simple. The NN is expected to make a yes-no decision as output. This is a classification problem with a low number of parameters. You need to obtain training data that should be recordings of games played by humans. The base logic is to check what was the starting hand of a player and check how much money the player won in that game that defines an expected decision whether to fold or join the game in the beginning. You may choose an RBF network for this. Defining the learning algorithm and presenting the training data would train your NN. You may choose random walk as your first training method. After training, your NN should be able to decide if you should play with a given hand or not. A poker database is available from the University of Alberta that can be used to create training data:
http://poker.cs.ualberta.ca/irc_poker_database.html

Manngo
  • 829
  • 7
  • 24
  • I cannot really choose that as the correct answer but I think there is no correct answer to my question, so.. But thank you very much for the explanation and also for your proposed idea! I will think a bit more about my problem and then I might change to a simpler :) – greece57 Feb 10 '17 at 23:33