Question with MiniMax logic...
Okay, so I may be looking at this wrong or not understanding something properly. But I have been doing a lot of reading on the recursive Minimax(and AlphaBeta) decision making logic. Most of it makes sense to me, but I am still a little confused on how to actually put it all together.
I'm going to be using it with a connect 4 game, so each turn can only have 7 possible moves at the most. I understand how to make my possible moves list and how the function will recursively search through each move until it either reaches the end of the game(or the designated depth of search), or finds a winning move or a losing move...
This is where I am a little unsure...once it reaches an end point, it then sends and integer score value back down all the functions opened up in this game tree. I know it will compare all the values returned and in the end you will end up with the highest value, which theoretically means the best move.
What I don't understand, is that if all you are left with is a value how do you know which move the value came from? Do you have to call the minimax function for each of the possible moves you can do and then compare all the values for each move? That seems like a whole lot of work on the computer's part.
Maybe I am looking at this wrong or am missing something, but if anyone can offer some guidance or just point me in the right direct, I am THIS close to grasping how the concept works, I just need to put it all together...
THANKS!
If you want the rainbow, you've gotta put up with the rain - do you know which philosopher said that? Dolly Parton. And people say she's just a big pair of tits.
December 08, 2005 12:24 PM
Treating the first move as a special case and finding the best first move isn't much extra work at all. You'd be searching those moves with the recursive method anyway. All you're doing is finding which first move is best, using the recursive part to search for the value of that move by going the rest of the way down the tree. You just check each of the possible moves and find the one with the maximum value. It's no different than finding the element in an array with the highest value.
You call minimax for each move and pick the best. This is not too much work, since calling minimax on the current position would have done the exact same thing. The function that loops through the moves and calls minimax will look very similar to minimax itself, but I recommend you keep them as two separate functions, since there are too many things that you will want to do differently at the root (iterative deepening, printing some information as you search, time control...).
Okay, yea I think I goten it all a little mixed up in my head.
So that is basically what I will want to do, is to use a loop to call the function for each of the possible first moves and then compare them all to find the first initial move with the greatest value? Okay that makes sense.
And I don't know why I figured that would be so much more work for the computer, as it will still be searching the same amount of moves...
Thank you for your reply!
So that is basically what I will want to do, is to use a loop to call the function for each of the possible first moves and then compare them all to find the first initial move with the greatest value? Okay that makes sense.
And I don't know why I figured that would be so much more work for the computer, as it will still be searching the same amount of moves...
Thank you for your reply!
If you want the rainbow, you've gotta put up with the rain - do you know which philosopher said that? Dolly Parton. And people say she's just a big pair of tits.
December 08, 2005 04:37 PM
Actually I misread what you wrote at first, I think you were going to find the value of the best move, and then go back and evaluate every move until you found the one that matched the previously found highest value. And that would require evaluating moves more than once, which is pointless.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement