Author: Sune Fischer
Date: 06:44:34 02/09/04
Go up one level in this thread
On February 09, 2004 at 09:18:48, Maurizio Di Vitto wrote:
>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:
You don't need a complex unmakemove to undo a move :)
It's one of those areas where you must consider the trade off between complexity
and a possible increase in speed.
The advantage of unmaking is that you don't have to worry so much about the size
of your structures.
>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.
Yes the copying is doing the work the unmake would otherwise have done.
-S.
>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.