Author: José Carlos
Date: 09:59:29 02/11/00
Go up one level in this thread
On February 11, 2000 at 10:42:12, Per Steneskog wrote:
>Howdy!
>
>Since january, I am writing a little chessplaying program. So far it has went
>rather smooth until it introduced alphabeta cut-offs. Debbuging the move-tree
>shows it cut-offs and back-ups scores as expected. But I am not sure how to
>produce the principal variation and how to update it.
>
>I have taken a look at the source of some other engines, but embarrasing I
>haven't been able to solve it. Clearly the pv should only be updated when you
>have a cut-off (alpha < score < beta). But how do I know I am within the pv and
>at what ply?
>
>Sorry for asking this, I am pretty sure I would have found the answer if the
>content of the archive for CCC was searchable.
>
>More questions will come... :-)
>
>Best regards
>Per Steneskog a.k.a. Epor@ICC
What I do in Averno is pretty simple: just declare a 2-dimension array that is
used as a triangular array
tmove PV[MAX_MOVES][MAX_MOVES];
Then, everytime you got a PV move (between alfa and beta) you call UpdatePV
(ActualizarPV in the code below). You have to be careful about the way you got
to that move, for example, if it is a hash table hit, a 3rd repetition rule or
so.
void CTablero::ActualizarPV(Jugada mov)
{
PV[Ply][0]=mov;
memcpy(&PV[Ply][1],&PV[Ply+1][0],sizeof(Jugada)*(MAX_PLIES-Ply));
}
So I just put the current move int the top of the PV and copy everything that
lies below. Then, when I print the PV, I must be careful about how many moves
belong to this PV, and ignore the rest that are there from previous PV's.
José C.
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.