No lazy eval. I've seen that it fail sometime low sometime high but only when val is negative. I've think to go back and restart from a simpler approach, just to understand how to handle correctly the alfabeta window.bob wrote:[...]
I assume you don't do lazy eval either?
You could just dump the two trees and see where they differ, since they should not.
First step:
Code: Select all
val = -AlfaBeta(-valok, valInfinity, iDepth - 1);
Now i can say: "ok, so the opponent can't reach a value lower than valok" but i need a +1, because comparing with beta is not simmetric (it use val>beta to cut the node and <= to don't cut):
Code: Select all
val = -AlfaBeta(-valok, -valok+1, iDepth - 1);
And now why not -1/+1, as you suggested?
Code: Select all
val = -AlfaBeta(-valok-1, -valok+1, iDepth - 1);
But if this were the error... lets try again:
Code: Select all
val = -AlfaBeta(-valok, -valok, iDepth - 1);
I'm happy, i can bury my old alfagemma and experiment with alfabeta, now.
Many thanks to all of you.