i am new to minimax algorithm. while searching in google i could roughly understand the basics of minimax. i do have a doubt in using it for tic tac toe. at each stage max will choose the node with maximum value in its child. but how do we evaluate the leaf nodes? i cant guess any function for that.

3
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by fenerista

Is the leaf node a final state? If so, then it has +verymuch if a win, -verymuch if a loss and (whatever you deem appropriate) if it a draw.

Look in the right column of this page, near the top. See all the related DaniWeb posts? Some of them may be quite useful.

Edited by griswolf: n/a

I did a tictactoe program that has a artificial intelligence for pc move. But I don't use known/common way. Just I did myself.

If you ask what I did. I 'll explain.

In tictactoe there are these states that are important for the game.

a "A" state.

X 2 X let's call this as " danger "
O 5 6
7 8 9

a "B" state. " " "two danger"
X 2 X
O 5 6
X 8 O

A- if a danger exist in a state the next player must move to 2 according to upper state.
B- if there are two danger at same time so the player will lose.

You must look for these states.

You must make the pc play on a virtual tictactoe table. and if the state "A" exist you must make the player play there(the space that left) and continue the look for these states.

and if state is "B" so, you should't play the "move" that brings you this state. and the user can trap you with a A state .The user make a "danger" and you must play to the space. Then he can make a "B" state than.

I don't know how I tell you my algorithm. But this can help you to make a function you want.

Whatever I think I have full source code that I found it on intenret for tictactoe that is using minimax algorithm If I can find I will add it here.

Edited by fenerista: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.