Computer Chess Club Archives


Search

Terms

Messages

Subject: Search function...

Author: Maurizio Di Vitto

Date: 06:18:48 02/09/04


Thanks a lot for your help,
I just want to ask something about your crbmg.cpp.
There a Board class member function called Perft(unit dept) that looks like a
search function, I mean It doesn't search the right move but just explore the
tree with a given depth. So I analyzed it for a long time and I' stopped my
attention to this line:

*this=*pboard;  // undo move by copying back the board

I noticed that it really undo a move,all the bitboard (tell me if I'm in
trouble),state like castle, epfile etc..
So the question is if I really need a complex UnMakeMove to undo a move:

void Board::Perft(uint depth) {
	Board *pboard = &tree.boards[ply];
	int i=-1,movesfound=0;
	Move *pmove;
	uint nmoves;

	*pboard=*this;											// save entire board to stack, so we can undo any
moves made
	GenMoves();

	pmove = tree.first_move[ply];							// just like in TSCP, I think
	nmoves = tree.first_move[ply+1]-tree.first_move[ply];

	while (++i<nmoves) {
		if(!MakeMove(pmove+i))
			continue;
		++movesfound;
		if (depth>1)
			Perft(depth-1);
		*this=*pboard;		            // undo move by copying back the board
	}
	NodeCount[ply+1] += movesfound;

	return;
}
I think that you can use the MakeMove instead of ++movesfound.Obviosly I need to
search the right move using an evaluation function, but I wanted just to know if
*this=*pboard; could replace an UnMakeFunction.
Thanks again for your help.
Maurizio Di Vitto



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.