![Crying or Very Sad :cry:](./images/smilies/icon_cry.gif)
My doubt today (actually not just one
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
From Bruce Moreland's archives (and almost everywhere in the net) I've found the following code:
Code: Select all
int AlphaBeta(int depth, int alpha, int beta)
{
if (depth == 0)
return Evaluate();
GenerateLegalMoves();
while (MovesLeft()) {
MakeNextMove();
val = -AlphaBeta(depth - 1, -beta, -alpha);
UnmakeMove();
if (val >= beta)
return beta;
if (val > alpha)
alpha = val;
}
return alpha;
}
Code: Select all
int AlphaBeta(int depth, int alpha, int beta)
{
if (depth == 0)
return Evaluate();
GenerateLegalMoves();
while (MovesLeft()) {
MakeNextMove();
val = -AlphaBeta(depth - 1, -beta, -alpha);
UnmakeMove();
if (val > alpha) {
if (val >= beta)
return beta;
alpha = val;
}
}
return alpha;
}
If alpha < beta they does the same thing, otherwise the result should be different.
I'm sorry if my question has been asked somewhere and even if it looks pretty stupid, but I'm just trying to understand and I haven't found an answer elsewhere. And the desidere to learn isn't a fault yet
![Mr. Green :mrgreen:](./images/smilies/icon_mrgreen.gif)
Thanks in advance,
Luca