Skip to main content
GameDev.net gamedev.net
🔒 Locked

Neural network for ultimate tic tac toe

Started by rots32 May 16, 2016 at 1:49 PM 2 replies 6.5k views
Original Post
rots32
rots32

I recently found a new interesting game for which I tried to design an AI, it's called Ultimate Tic Tac Toe. Here's a link with a description of the game:

https://mathwithbaddrawings.com/2013/06/16/ultimate-tic-tac-toe/ . I made a simple alpha-beta algorithm that works fine but I was wondering how

can I use a neural network to play the game. Can give me some tips on how the neural network should be designed and used?

Alberth
Alberth

Like you I have never programmed any of it. My first action would be to look for some explanation of how they work and how to program them at the Internet.

HappyCoder
HappyCoder
Neural networks good for taking complicated mathematical equations and building an approximation for it. You do this by supplying some inputs, see what outputs they give in some complicated system, then training the network with the given inputs and outputs. Eventually you can use the neural network to make rough approximations of what the complicated system will do given some inputs.

Turn based board games with no random chance can usually have an AI similar to chess. So I would look into existing chess AI implementations that use neural networks and see what you can glean from that.

This link looks promising
http://erikbern.com/2014/11/29/deep-learning-for-chess/
My current game project Platform RPG
alvaro
alvaro
The natural place to use a neural network in that game is in writing an evaluation function. This NN will be a function that takes the current game situation as input and outputs a single real number, which is something like the expected result of the game, where +1 means X wins and -1 means O wins.

You can use a regular feed-forward neural network, which are the easiest type to understand. You can give it something like 81 inputs describing what's on the board, 9 describing what sub-boards are closed and 9 indicating what sub-board the next move should be at. Have a few hidden layers using rectified linear units. The last layer can use a tanh activation function to bring the result to the range [-1,+1].

Write an alpha-beta search that uses the NN plus a small amount of noise for evaluation. Initialize the NN using small weights, so the output for any input will be very close to 0 (so the alpha-beta search will be using a random evaluation function at this point). Now you can play games where the program plays itself. After you have a few thousand games, you can start training the neural network to predict the result of the game. You can alternate generation of games and training of the network for a few iterations (say 4).

I did something like this for Spanish checkers at the beginning of 2015, and it worked great.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.