Author: James Swafford
Date: 16:33:31 10/26/99
Go up one level in this thread
On October 26, 1999 at 19:05:32, Nicolas Carrasco wrote:
>Dear Guys,
>
>I am still haveing problems storeing the PV data at this simple Alpha-Beta
>Algorim.
>
>int AlphaBeta (depth, alpha, beta)
>{
> int score;
>
> if (depth == 0)
> return Evaluate(pos);
>
> succ = Successors(pos);
> i = 0;
>
> while (i<succ)
> {
> i++;
> if (make_move(move_list[i])) {
> score = -AlphaBeta (-depth, -beta, -alpha);
> unmake_move();
>
> if(score>alpha){
> if (score>beta)
> return beta;
> alpha = score;
> }
> }
> return alpha;
>}
>
Update if score > alpha, but not if score >= beta.
After the line alpha=score; add the code below
(or better yet do a memcopy).
If you work through a simple search, you'll see that
at ply N you place your best move at pv[n][n].
The rest of the line is "pulled up." So
pv[n][n+1]=pv[n+1][n+1] and pv[n][n+X]=pv[n+1][n+X].
At the very root, you'll place the best move at
pv[0][0], and pull up the rest of the line from
pv[1][1] - pv[1][MAX].
Draw it out. :-)
--
James
>
>Many arrays programs put something like this:
>
>pv[ply][ply] = move[ply].b[i];
>
>for(j=ply+1;j<pv_length[ply+1];j++)
> pv[ply][j] = pv[ply+1][j];
>pv_length[ply] = pv_length[ply+1];
>
>Where I have to put that? How it works?
>
>Thanks
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.