# MixiMax Algorithm How to

This topic is 3091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I programmed a fully functional tic-tac-toe game about 3 or 4 months ago. I had no idea what I was doing with AI and it wound up simpley being a if statement system but nothing to check which of the movie was the best for the computer to take. My language of choice is C++. If you can direct me to an example code or something it would be much appreciated. Thanks!

##### Share on other sites
I understand that because 3x3 tic-tac-toe is very simple You have hard-coded response for every possible combination. In fact it has nothing in common with AI. 3x3 tic-tac-toe doesn't require MinMax algorithm to play perfectly. You can simply calculate score of every empty square and choose the square with highest score as the best computer move. MinMax can of course be used because it's zero-sum, two-person game. Have a look at this page.

##### Share on other sites
While tic-tac-toe is a very simple game, not needing a large game tree.

Here is a good page (with tic-tac-toe example) to read on using minimax.

http://www.ocf.berkeley.edu/~yosenl/extras/alphabeta/alphabeta.html

##### Share on other sites
That looks like a really awesome link I'm going to check that out in detail as soon as I get home from work this evening... I dont have the old program handy but the end result was less than 200 lines of code because of using nested for loops but the procedure for checking the board for a win and checking to get possible move was almost the same.. And basically there was a lot of flaws in the code

1. 1
2. 2
Rutin
18
3. 3
khawk
15
4. 4
A4L
14
5. 5

• 10
• 13
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633746
• Total Posts
3013668
×