T
T
Tarasov Konstantin2014-06-16 00:36:08
Programming
Tarasov Konstantin, 2014-06-16 00:36:08

How to train a neural network to play tic-tac-toe?

Wrote a network that plays tic-tac-toe. The question arose - how to teach? The first thing I tried was random. I put it against a random 70% win 10% draw. I tried to play against the network trained in this way myself - in fact, it only learned the rules of the game properly. He is trying to line up a row of three zeros without noticing my moves.
It's no good. I put two networks to play against each other - 100% draw. He began to punish for draws as for losses - 50/50 wins with any number of runs. I decided to try to first teach the network the rules of the game using random, and then put it to play against another network that was trained in the same way - as a result, either 50/50, or with a certain chance, one network overtakes the other at the very beginning and wins 100% of the games. I tried to play with the network after learning each of these ways - they play badly (
How can you programmatically train such a neural network? Play with it yourself or manually score all the combinations - I didn’t learn to write code for this. It should be possible to teach somehow, because, as you know, by acting correctly in tic-tac-toe, you can get 100% non-losing, and 80% against a pathetic random is somehow not ice :\

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Sergey, 2014-06-16
Protko @Fesor

You would at least describe what kind of network, what configuration, etc. And why precisely neurons?

A
afiskon, 2014-06-16
@afiskon

Tic-tac-toe is not an interesting task, since the number of states is very small and, in fact, with a pen and paper, you can easily compose everything. The input will turn out - the current state, the output - where and what to look like. You don't even need a neural network here. And then, any game can be reduced to a draw, which explains the result obtained when playing one NS with another.
Here, I think, with backgammon or checkers it will be much more interesting. Or tic-tac-toe on a large field, where you need to put N tic-tac-toe in a row at least.

F
Funbit, 2014-06-16
@Funbit

Tic-tac-toe is not well suited for neural networks. In this game, all moves can be easily calculated .

P
Puma Thailand, 2014-06-16
@opium

You probably have a shitty random, do you initialize it from the current time?
Well, you need more details about what kind of network you have.

K
kosmos89, 2014-06-16
@kosmos89

So what is the topology of a neural network? Different networks train differently. Wangyu that a 3-4 layer network will do the job. ORO (Back Propagation) can be trained. Probably.

A
Alexander Kosheverov, 2014-06-16
@Iworb

You will not train such a network normally, since the relative positions of crosses and zeroes are not taken into account. Add a hidden layer with at least 1 neuron (preferably not a perceptron) to get a more acceptable result.
I also advise you to replace the perceptrons at the output with something else so that the computer can choose where to look better. Now, as I understand it, you just have 1 where you can walk around.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question