3 Commits

Author SHA1 Message Date
239498bc2a cleanup 2024-05-16 07:29:02 +02:00
a012af30fc fix wrong recursive call in perft_test() 2024-05-16 07:27:59 +02:00
d1cb1f3c2c perft-test: re-use pos 2024-05-16 07:27:35 +02:00
2 changed files with 5 additions and 4 deletions

View File

@@ -105,7 +105,7 @@ u64 perft_test(pos_t *pos, int depth, int ply, bool output)
nodes++;
} else {
move_do2(pos, *move, &state);
subnodes = perft(pos, depth - 1, ply + 1, output);
subnodes = perft_test(pos, depth - 1, ply + 1, output);
if (output && ply == 1) {
char movestr[8];
printf("%s: %d\n", move_str(movestr, *move, 0), subnodes);

View File

@@ -235,7 +235,7 @@ int main(int __unused ac, __unused char**av)
int i = 0, test_line;
u64 sf_count = 0, my_count;
char *fen;
pos_t *pos;
pos_t *pos = NULL, *fenpos;
pos_t *fishpos = pos_new();
movelist_t fishmoves;
//move_t move;
@@ -288,10 +288,11 @@ int main(int __unused ac, __unused char**av)
CLOCK_DEFINE(clock, CLOCK_PROCESS);
while ((fen = next_fen(PERFT | MOVEDO))) {
test_line = cur_line();
if (!(pos = fen2pos(NULL, fen))) {
if (!(fenpos = fen2pos(pos, fen))) {
printf("wrong fen %d: [%s]\n", i, fen);
continue;
}
pos = fenpos;
if (sf_run)
sf_count = send_stockfish_fen(outfd, fishpos, &fishmoves, fen, depth);
@@ -354,11 +355,11 @@ int main(int __unused ac, __unused char**av)
}
printf("\n");
// pos_del(savepos);
pos_del(pos);
i++;
/* to run first test only */
// exit(0);
}
pos_del(pos);
if (run & 1) {
if (!res[0].ms)
res[0].ms = 1;