I just cannot trace a simple bug and I don't like it. Bugs sometimes indicate something else more serious amiss elsewhere.
The following is my perft run from the start position:
perft 1 20, nps(0)
perft 2 400, nps(440000)
perft 3 8902, nps(256894)
perft 4 197281, nps(387057)
perft 5 4865609, nps(147223)
^C
rasjid@debian:~/cowrie/optimized/src$
The perft numbers are correct, but the nps is far below that of the release mode nps! The release mode nps is about 1.2 - 1.7 million with a material+pst only evaluation on my athlon64 3500+
I have tried replacing the make/umake, the timers, the generators and turning of the interrupts but all to no avail.
Can someone suggest what the likely problem is.
Code: Select all
static u32 perftnodes;
static void search_perft(int depth, int side){
move_t movestack[256], *m;
check_t check_s[1];
is_incheck(check_s, side);
m = gen_all(movestack, check_s, side);
if (m != NULL);
else {
return;
}
++nodes;
if (depth == 0) {
++perftnodes;
return;
}
for (m = movestack; *m; ++m){
makeperft(*m, side);
search_perft(depth - 1, side ^ 1);
unmakeperft(*m, side);
}
return;
};
static void perft(const char *fen, int n){
move_t movestack[256], *m;
check_t check_s[1];
int ms, side, depth, nps;
struct timeval start;
printf("perft on\n\n");
stage = 0;
side = setfenboard(fen);
is_incheck(check_s, side);
m = gen_all(movestack, check_s, side);
if (m == NULL) {
return;
}
nodes = 0;
gettimeofday(&start, NULL);
for (depth = 1; depth <= n; ++depth){
perftnodes = 0;
for (m = movestack; *m; ++m){
makeperft(*m, side);
search_perft(depth - 1, side ^ 1);
unmakeperft(*m, side);
}
ms = msecfrom(&start);
nps = 0;
if (ms > 0) {
nps = (nodes * 1000 / ms);
}
printf("perft %d %lu, nps(%d)\n", depth, perftnodes, nps);
}
}
int main(int argc, char *argv[])
{
char line[256], command[256];
setbuf(stdin, NULL);
setbuf(stdout, NULL);
init_rotate();
init_pst();
init_pawn_shelter_tables();
init_material_table();
allocatehash(40);
#if PERFT
perft(FEN_STARTPOS, 20);
goto RET;
#endif
...
}