Connect - 4

Stef

Distinguished
Sep 8, 2002
38
0
18,530
Archived from groups: comp.ai.games (More info?)

Hello,

I've just made a connect 4 game with an AI that uses Minimax with
Ab-pruning. Now i 've read some articles about neural networks and i want to
try it on my program but i don't really see what my input and output should.
Can i use this neural network to decide which column to play or just to
evaluate a board in my minimax tree?

Thanks in advance.

B.
 
Archived from groups: comp.ai.games (More info?)

"stef" <bastin@xs4all.be> wrote in
news:40968f43$0$564$e4fe514c@news.xs4all.nl:

> Hello,
>
> I've just made a connect 4 game with an AI that uses Minimax with
> Ab-pruning. Now i 've read some articles about neural networks and i
> want to try it on my program but i don't really see what my input and
> output should. Can i use this neural network to decide which column to
> play or just to evaluate a board in my minimax tree?

Well, as inputs you could consider one input for each field in each column,
giving a -1 when a piece of the opponent is there, 1 for a piece of the
player itself, and a zero if it's empty. For outputs, you could use an
output neuron for each column, the neuron with the highest activation level
then would give the column where should be played.
The problem with this is the evaluation. With what data will you train your
neural network ? You only know if it's playing good or bad when the game is
over, and if you adapt the network weights then, you should do so for all
moves - even the ones which were very good, if the game would lose because
of one silly mistake at the end.
You *could* use minimax for the evaluation of any board, to train the
network. Whether this is useful, that is another question.

So, in short, the point is that, to train a neural network, you should have
some evaluation of the boards on which it is trained. Afterwards, yes, such
a network could be used to evaluate an arbitrary board position (you should
then have only a single output neuron, or two : one for each opponent, the
neuron with the highest activity would give the most probable victor).

--
Pento

De wereld was soep, en het denken meestal een vork,
tot smakelijk eten leidde dat zelden. - H. Mulisch
 
Archived from groups: comp.ai.games (More info?)

stef a écrit :
> Hello,
>
> I've just made a connect 4 game with an AI that uses Minimax with
> Ab-pruning. Now i 've read some articles about neural networks and i want to
> try it on my program but i don't really see what my input and output should.
> Can i use this neural network to decide which column to play or just to
> evaluate a board in my minimax tree?

Both practices exist ; but I guess a neural network providing a board
evaluation for your minimal tree may give a better result.

--
Richard
 
Archived from groups: comp.ai.games (More info?)

Pento <robby.goetschalckx@student.kuleuven.ac.be.NOSPAM> wrote in message
>
> > Hello,
> >
> > I've just made a connect 4 game with an AI that uses Minimax with
> > Ab-pruning. Now i 've read some articles about neural networks and i
> > want to try it on my program but i don't really see what my input and
> > output should. Can i use this neural network to decide which column to
> > play or just to evaluate a board in my minimax tree?
>
> Well, as inputs you could consider one input for each field in each column,
> giving a -1 when a piece of the opponent is there, 1 for a piece of the
> player itself, and a zero if it's empty. For outputs, you could use an
> output neuron for each column, the neuron with the highest activation level
> then would give the column where should be played.
> The problem with this is the evaluation. With what data will you train your
> neural network ? You only know if it's playing good or bad when the game is
> over, and if you adapt the network weights then, you should do so for all
> moves - even the ones which were very good, if the game would lose because
> of one silly mistake at the end.

Are you saying that i should keep track of al the moves made in a game
and at the end of the game use back prop on each move that was made.
And if the game leads to a win then calculate the error on the column
with 1 and otherwise with 0???
Do you mean something like that ?
 
Archived from groups: comp.ai.games (More info?)

Pento <robby.goetschalckx@student.kuleuven.ac.be.NOSPAM> wrote in message news:<Xns94DF7933C4E6robbygoetschalckxstu@134.58.127.12>...
> "stef" <bastin@xs4all.be> wrote in
> news:40968f43$0$564$e4fe514c@news.xs4all.nl:
>
> > Hello,
> >
> > I've just made a connect 4 game with an AI that uses Minimax with
> > Ab-pruning. Now i 've read some articles about neural networks and i
> > want to try it on my program but i don't really see what my input and
> > output should. Can i use this neural network to decide which column to
> > play or just to evaluate a board in my minimax tree?
>
> Well, as inputs you could consider one input for each field in each column,
> giving a -1 when a piece of the opponent is there, 1 for a piece of the
> player itself, and a zero if it's empty. For outputs, you could use an
> output neuron for each column, the neuron with the highest activation level
> then would give the column where should be played.
> The problem with this is the evaluation. With what data will you train your
> neural network ? You only know if it's playing good or bad when the game is
> over, and if you adapt the network weights then, you should do so for all
> moves - even the ones which were very good, if the game would lose because
> of one silly mistake at the end.

Are you saying I should keep track of all the moves made in a game and
once the game is finished apply back prop to each move?
 
Archived from groups: comp.ai.games (More info?)

stefaan_bastin@hotmail.com (B) wrote in
news:cf33d12f.0405050250.61128afc@posting.google.com:

> Are you saying I should keep track of all the moves made in a game and
> once the game is finished apply back prop to each move?

That was what I was saying. It is clear, though, that this might not be the
best way to handle this 🙂

--
Pento

De wereld was soep, en het denken meestal een vork,
tot smakelijk eten leidde dat zelden. - H. Mulisch
 
Archived from groups: comp.ai.games (More info?)

stef wrote:
>
> Hello,
>
> I've just made a connect 4 game with an AI that uses Minimax with
> Ab-pruning. Now i 've read some articles about neural networks and i want to
> try it on my program but i don't really see what my input and output should.
> Can i use this neural network to decide which column to play or just to
> evaluate a board in my minimax tree?
>
> Thanks in advance.

There is an enjoyable book about developing an ANN for use with minimax
& pruning in a checker player. It's called "Blondie24", by David Fogel.

You might like to follow his approach.

Mitchell Timin

--
"Many are stubborn in pursuit of the path they have chosen, few in
pursuit of the goal." - Friedrich Nietzsche

http://annevolve.sourceforge.net is what I'm into nowadays.
Humans may write to me at this address: zenguy at shaw dot ca