Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: perft(2) -> 420

Author: Roman Hartmann

Date: 14:15:14 02/22/06

Go up one level in this thread


On February 22, 2006 at 17:02:48, Stuart Cracraft wrote:

>On February 22, 2006 at 16:53:37, Roman Hartmann wrote:
>
>>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
>
>
>At http://www.albert.nu/programs/sharper/perft.htm, the author
>says he has verified perft(up to 10) with a variety of engines as:
>
>Initial position rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
>Depth	Perft value
>1	20
>2	400
>3	8902
>4	197281
>5	4865609
>6	119060324
>7	3195901860
>8	84998978956
>9	2439530234167
>10	69352859712417
>
>So it is in disagreement for 3 with 9322.
>
>When I run my perft(up to 5), I get
>
>1 20
>2 420
>3 9322
>4 206603
>5 5072212
>
>So now I am more confused. What's right? Who's wrong?
>
>--Stuart

In one case it's the total number of nodes to depth and in the other it's the
total number of nodes to the desired depth minus the total nodes to depth-1.

In some engines you can also output the total number of nodes (my engine does
that as an example with 'perft2 #').

Roman

PS: your perft 6 should be 124132536 btw



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.