Jump to content
  • Advertisement
Sign in to follow this  
sleeper123

minimax search related question

This topic is 4267 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

Hi, I've got a question regarding applying minimax to tic-tac-toe. This involves using no heuristics and creating the full tree of all possible play. If we take the possible squares as :- A | B | C - - - - - D | E | F - - - - - G | H | I From the start of the game the first player could place an x in any of A-I. If you use minimax (as I understand how it works anyway?) to determine where it should place its move, then it could be any of them as from this position all lower nodes will have an equal value. So to get the choice of where to play first and not always the same square, is it as simple as choosing a random square? Also as we move down the tree (ie. as the game progresses) there will be other circumstances where the most favourable lower nodes will have the same value, so again at this point is it a case of picking a random lower node from the favourable ones? More generally, are my questions above valid or am I missing something fundamental about assigning values to the various nodes of the tree? If so could someone try and correct me (by the way I've understood the assigning system a node can have one of only three values : -1 , 0 and 1)

Share this post


Link to post
Share on other sites
Advertisement
What you are saying is basically correct. A simple way of picking a good random move is to use random numbers as the evaluation of draws.

You also have the problem that a pure minimax searcher like that will not prefer short wins to long ones, so in this position both D and H win the game, but D looks silly:
x|o| 
-+-+-
|o|
-+-+-
x| |


I would do something like this to solve both problems:
* A win by player 1 has a score of 120-n, where n is the number of moves played on the board.
* A win by player 2 has a score of -120+n.
* A draw has a score of -100+(std::rand()%201).

That should behave correctly in all situations.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!