1

I am new in AI and I am trying to implement tic tac toe game with minimax algorithm but before get into that I want to check my understanding about implementation:

first at each step of the move according to current state of my grid I create decision tree and after the decision tree is made I will apply minmax to mark the tree and then choose according to that marks find the best next move then again make the decision tree for the chosen move from scratch and apply the minmax again and choose the best move. Here is the pseudo-code that I designed:

move(current state)
{
  tree=make_decision-tree(current state);
  maxminalg(tree);
  choose the best move according to the returned max or min from the tree
  foreach (choice in choosen state)
    move(choice)        
}
make_decision-tree(current state)
{
    ....
}
maxminAlg(decisiontree t)
{
   return max or min
}

My question is if this procedure that I designed is correct (because if it is correct then I can start coding that) and if not what is your suggestion?

Jim Fell
  • 13,750
  • 36
  • 127
  • 202
HMdeveloper
  • 2,772
  • 9
  • 45
  • 74
  • 3
    Good for learning proper AI concepts but you probably don't need minimax for a game that only has about 20,000 possible game states :-) – paxdiablo Jan 03 '14 at 03:48
  • Just to make sure about my understanding , when I make the decision tree for each new move is it reasonable? – HMdeveloper Jan 03 '14 at 04:00

1 Answers1

1

minimax gets SO complicated so fast.

This post really sheds a lot of light on the topic: Simple tic-tac-toe AI

Community
  • 1
  • 1
Matt617
  • 458
  • 2
  • 14
  • Just to make sure about my understanding , when I make the decision tree for each new move is it reasonable? – HMdeveloper Jan 03 '14 at 04:07
  • 1
    i would say yes, how else would you truly me "making a decision" per move? – Matt617 Jan 03 '14 at 04:10
  • For example what is the problem with making decision tree once and then use it for decision at each new move?(though I think recreating decision tree at each step is more reasonable) – HMdeveloper Jan 03 '14 at 04:13
  • well now your talking about creating a seperate abstract decision tree function and calling it? thats really more an efficiency question right? – Matt617 Jan 03 '14 at 04:16
  • Yes.So you mean the second approach is more efficient am I right? – HMdeveloper Jan 03 '14 at 04:18
  • 2
    depends on the langue, typically yes in most interpreted languages but in something like C++ where you tightly control the scope its possible re-creating it all the time would be more efficient. also if your decision tree concept is very dynamic maybe your re-creating it in memory each time regardless of if you call it by reference. – Matt617 Jan 03 '14 at 04:20