MixiMax Algorithm How to
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!
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.
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
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement