Computer Chess Club Archives


Search

Terms

Messages

Subject: Need some help with move ordering and PV

Author: syed

Date: 07:11:54 12/27/98



       The following is a portion of source code taken from TSCP. I am trying to
go through the source code and find out how a chess program works. I have been
having a tough time trying to understand the move ordering process. Could some
one please explain the code under the section titled '/*update the pv*/':

/* loop through the moves */
	for(i=gen_begin[ply];i<gen_end[ply];i++) {
		sort(i);
		if(!makemove(gen_dat[i].m.b))
			continue;
		f=TRUE;  /* we found a legal move! */
		x=-quiesce(-beta,-alpha);
		takeback();
		if(x>alpha) {
			if(x>=beta)
				return(beta);
			alpha=x;

			/* update the PV */
			pv[ply][ply]=gen_dat[i].m;
			for(j=ply+1;j<pv_length[ply+1];j++)
				pv[ply][j]=pv[ply+1][j];
			pv_length[ply]=pv_length[ply+1];
		}
	}

I have the following questions:

1.) How does this move ordering array pv[][] work?

2.) Why do we need to store the whole sequence of moves, since we select only
the best one? i.e pv[0][0]

3.) Why do we store the pv_length?

4.) Where could I find some more information on coding alpha-beta, PV etc.

thanks in advance,
syed



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.