# Creating the evaluation function for Minimax

Printable View

• 11-04-2009, 02:38 PM
matzahboy
Creating the evaluation function for Minimax
For a game I am making, I want to use the Minimax algorithm to program the AI. The 2 players have 2 different evaluation options (because the way player1 and player2 win are different).

Can player1's evaluation function return values from 1-10, while player2 returns from 1-20? Or will this mess up the Minimax algorithm? Basically, my question is: Do the 2 evaluation functions have to be on the same scale (so a 5 in one is the same as a 5 in the other)?
• 11-04-2009, 04:32 PM
Lizzip
Im not quite sure I understand Minimax exactly, but from looking at it I assume that they could return different values as long as you then compare the outputs to seperate winning conditions for each player
• 11-04-2009, 04:54 PM
JosAH
If you strictly use one evaluation function for the even levels and the other one for the odd levels it doesn't matter whether or not they return values from different ranges.

kind regards,

Jos
• 11-04-2009, 11:51 PM
fgm1
I'm not 100% certain, but I really think you might run into problems by having a different set of evaluation values for White and Black. One of the key aspects of minimax algorithm is that you need a consistent way of determining whether a position favors White or Black. I don't see how you can do that when you return a different set of values for each. How are you gonna compare the values? I'm nt saying it can't be done, just that It's not clear to me that you understand the key concept of deciding who is better.

That being said JosAH says no problem. So maybe he knows something I don't. So Jos, how do you respond to my point?

regards.
• 11-05-2009, 08:38 AM
JosAH
Quote:

Originally Posted by fgm1
That being said JosAH says no problem. So maybe he knows something I don't. So Jos, how do you respond to my point?

regards.

If the 'other' evaluation function is a linear combination of the 'first' evaluation function (that's what I understood from the OP), i.e. E2(x) == a*E1(x)+b it doesn't matter whether or not you use E2 of E1, otherwise if E2(x) is completely different from E1(x) a different move can/will be selected. Both evaluation functions aim at a best move for a player so the combination E1 and E2 will behave as reasonable as both evaluation functions are.

kind regards,

Jos
• 11-05-2009, 04:09 PM
fgm1
Quote:

Originally Posted by JosAH
If the 'other' evaluation function is a linear combination of the 'first' evaluation function (that's what I understood from the OP), i.e. E2(x) == a*E1(x)+b it doesn't matter whether or not you use E2 of E1, otherwise if E2(x) is completely different from E1(x) a different move can/will be selected. Both evaluation functions aim at a best move for a player so the combination E1 and E2 will behave as reasonable as both evaluation functions are.

kind regards,

Jos

OK fine, I guess I can see how that would work, although it seems to me that if one eval function was a linear combination of the other, then it we should just as easily be able to do the combining ( or scaling) of the values within a single eval function, so that it returns a consistent set of values for both sides. That shouldn't be hard, since we should easily be able to pass (side to move to the single eval function)
• 11-05-2009, 04:15 PM
JosAH
Quote:

Originally Posted by fgm1
OK fine, I guess I can see how that would work, although it seems to me that if one eval function was a linear combination of the other, then it we should just as easily be able to do the combining ( or scaling) of the values within a single eval function, so that it returns a consistent set of values for both sides. That shouldn't be hard, since we should easily be able to pass (side to move to the single eval function)

Yes, true, but it was the OP who wanted to use two different evaluation functions ;-) If E2(x) == a*E1(x)+b then the function E1(x) == (E2(x)-b)/a might have been used as well.

kind regards,

Jos
• 11-05-2009, 04:29 PM
fgm1
Quote:

Originally Posted by JosAH
Yes, true, but it was the OP who wanted to use two different evaluation functions ;-) If E2(x) == a*E1(x)+b then the function E1(x) == (E2(x)-b)/a might have been used as well.

kind regards,

Jos

ok cool, we agree. Personally I'd much prefer to let my eval function deal with all of that, in order to simplify my minimax/alphaBeta code, but yeah if the OP wants two separate eval functions, then it can be made to work.

cheers.