Author: Peter Fendrich
Date: 10:26:20 04/11/00
Go up one level in this thread
On April 11, 2000 at 12:00:43, Severi Salminen wrote: >Hi! > >>int NegaMax (pos, depth) >>{ >> if (depth == 0) return Evaluate(pos); >> best = -INFINITY; >> succ = Successors(pos); >> while (not Empty(succ)) >> { >> pos = RemoveOne(succ); >> value = -NegaMax(pos, depth-1); >> if (value > best) best = value; >> } >> return best; >>} > >Thanks for explonations, but still: Let's say we have a white pawn at a6 and >king at a1 and a black queen at b7, rook at h2 and king at h8. It is white's >turn to move. (The text is right, not so sure about the diagram, my first...) > >[D]7k/1q6/P7/8/8/8/7r/K7 w - - 0 1 > >White has two alternatives: a7 and axb7(which is obviously better). We perform a >1 ply search using the above negamax. At first pass it sets BEST=-inf and starts >to scan the two moves. First it takes a7. As the evaluation of position after a7 >is -13 (only material) VALUE is set to +13. This is bigger than -inf so BEST is >now 13. Next we take axb7. The evaluation is -4 , so VALUE is +4. But this is >smaller than BEST (+13), so we won't take that move. So I STILL don't understand >something. I just want to get this right before I change to AB. > >Severi The code example above will work if Evaluate() returns the evaluation value computed from whites or black perspektive depending on whos move it is. Another way is to always return whites evaluation and use return -Evaluate(pos) respectively return Evaluate(pos) depending on who's move it is. //Peter
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.