perft-test: re-use pos

This commit is contained in:
2024-05-16 07:27:35 +02:00
parent 2069d6073d
commit d1cb1f3c2c

View File

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