Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Perft breakdown

Author: Keith Evans

Date: 15:43:30 12/02/03

Go up one level in this thread


On December 02, 2003 at 15:47:51, Slater Wold wrote:

>Keith and I (ok, Keith) did it using Crafty and Crafty's ICS output functions.
>
>Then a sort, and there's your list.  It was cake.
>
>Might not be specific enough for you, though.

My ugly hack to option.c was as follows - see the KME hacks. If you save the
results in a text file and sort it, then it's really trivial to do a diff
against a list that you generate in your program. This made debugging really
simple for me, but your mileage may vary.

===

void OptionPerft(TREE *tree, int ply, int depth, int wtm) {
  int *mv;
  static char line[256], *p[64];
#if defined(TRACE)
  static char move[16];
#endif

  tree->last[ply]=GenerateCaptures(tree, ply, wtm, tree->last[ply-1]);
  for (mv=tree->last[ply-1];mv<tree->last[ply];mv++) if (Captured(*mv) == king)
return;
  tree->last[ply]=GenerateNonCaptures(tree, ply, wtm, tree->last[ply]);
  p[1]=line;
  for (mv=tree->last[ply-1];mv<tree->last[ply];mv++) {
#if defined(TRACE)
// KME hack
//    strcpy(move, OutputMove(tree,*mv,ply,wtm));
    strcpy(move, OutputMoveICS(*mv));
#endif
    MakeMove(tree,ply,*mv,wtm);
#if defined(TRACE)
    if (ply <= trace_level) {
      strcpy(p[ply], move);
      strcpy(line+strlen(line)," ");
      p[ply+1]=line+strlen(line);
// KME hack
//      if (ply == trace_level) printf("%s\n",line);
      if ((ply == trace_level) && (!Check(wtm))) printf("%s\n",line);
    }
#endif
    if (depth-1) OptionPerft(tree,ply+1,depth-1,Flip(wtm));
    else if (!Check(wtm)) total_moves++;

    UnmakeMove(tree,ply,*mv,wtm);
  }
}



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.