Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: perft(2) -> 420

Author: Roman Hartmann

Date: 13:53:37 02/22/06

Go up one level in this thread


On February 22, 2006 at 16:48:10, Stuart Cracraft wrote:

>Pardon my blindness but I've been doing this too long.
>
>I wrote a quick perft which is buggy.
>
>It gives 20 for perft(1) but 420 for perft(2) - should be 400.
>
>It is:
>
>void perft(int *bd,int depth)
>{
>  int mvi;
>  mv ml[MAXMOVES];
>  if (depth<=0) return;
>  genmv(bd,ml,stm,NOSORT,SEENOTOK);
>  mvi = 0;
>  while (ml[mvi].from != -1) {
>    makemv(bd,ml[mvi]);
>    if (!incheckopp(bd)) {
>      totalnodes++;
>      perft(bd,depth-1);
>    }
>    unmakemv(bd);
>    mvi++;
>  }
>}
>
>The call is
>
>totalnodes = 0L;
>perft(bd,maxdepth);
>printf("nodes visited = %ld\n",totalnodes);
>
>Apart from the obvious that there could be a bug in my genmv(),
>is there anything about the above that would produce 420 instead
>of 400 for perft(2)?
>
>Thanks,
>
>Stuart
>
>P.S. I am working sick (and coding sick) for about 19 days now (flu,
>pneumonia, bronchitis) and am not seeing very obvious things which I
>would hope this is.

420 nodes sounds not too bad as this is the total sum of nodes up to depth 2.
perft 1 gives you 20 and perft 2 gives you 400 (420 - 20), so your numbers are
right.
If perft 3 gives you 9322, everything is fine.

Roman



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.