Jump to content
  • Advertisement
Sign in to follow this  
crazycode

MixiMax Algorithm How to

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!