Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: perft(2) -> 420

Author: Stuart Cracraft

Date: 14:36:27 02/22/06

Go up one level in this thread


On February 22, 2006 at 17:33:17, Robert Hyatt 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.
>
>
>Question is, what are you counting?
>
>Normally perft just counts leaf positions..  Sounds like you are counting all,
>because your number is 420.  there are 400 leaf positions, but then there are
>another 20 interior (ply-1 positions) giving a total of 420.
>
>

Thank you - that *IS* the bottom line. Revised code that matches the counts
on the website became:

void perft(int *bd,int depth)
{
  int mvi;
  mv ml[MAXMOVES];
  if (depth<=0) { totalnodes++; return; }
  genmv(bd,ml,stm,NOSORT,SEENOTOK);
  mvi = 0;
  while (ml[mvi].from != -1) {
    makemv(bd,ml[mvi]);
    if (!incheckopp(bd)) {
      perft(bd,depth-1);
    }
    unmakemv(bd);
    mvi++;
  }
}

Thanks,

Stuart



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.