misc.c: init_all()

This commit is contained in:
2024-05-15 18:34:50 +02:00
parent 022daf0a89
commit 86f8184c56
5 changed files with 14 additions and 15 deletions

View File

@@ -68,6 +68,9 @@ CPPFLAGS += -DWARN_ON # brlib bug.h
# fen.c
#CPPFLAGS += -DDEBUG_FEN # FEN decoding
# hash
CPPFLAGS += -DDEBUG_HASH # chk zobrist consistency
# attack.c
#CPPFLAGS += -DDEBUG_ATTACK_ATTACKERS # sq_attackers
#CPPFLAGS += -DDEBUG_ATTACK_PINNERS # sq_pinners details
@@ -342,12 +345,12 @@ TEST += movedo-test perft-test
PIECE_OBJS := piece.o
FEN_OBJS := $(PIECE_OBJS) fen.o position.o bitboard.o board.o \
hyperbola-quintessence.o attack.o
hyperbola-quintessence.o attack.o hash.o init.o
BB_OBJS := $(FEN_OBJS)
MOVEGEN_OBJS := $(BB_OBJS) move.o move-gen.o
ATTACK_OBJS := $(MOVEGEN_OBJS)
MOVEDO_OBJS := $(ATTACK_OBJS) move-do.o hash.o
PERFT_OBJS := $(MOVEDO_OBJS) search.o misc.o
MOVEDO_OBJS := $(ATTACK_OBJS) move-do.o misc.o
PERFT_OBJS := $(MOVEDO_OBJS) search.o
TEST := $(addprefix $(BINDIR)/,$(TEST))
@@ -387,7 +390,7 @@ bin/attack-test: test/attack-test.c test/common-test.h $(ATTACK_OBJS)
bin/movedo-test: test/movedo-test.c test/common-test.h $(MOVEDO_OBJS)
@echo compiling $@ test executable.
@$(CC) $(ALL_CFLAGS) $< $(MOVEDO_OBJS) $(ALL_LDFLAGS) -o $@
$(CC) $(ALL_CFLAGS) $< $(MOVEDO_OBJS) $(ALL_LDFLAGS) -o $@
bin/perft-test: test/perft-test.c test/common-test.h $(PERFT_OBJS)
@echo compiling $@ test executable.

View File

@@ -178,4 +178,6 @@ double clock_elapsed_sec(mclock_t *clock);
void rand_init(u64 seed);
u64 rand64(void);
void init_all(void);
#endif /* _CHESSDEFS_H */

View File

@@ -21,7 +21,7 @@
#include "hash.h"
void init_all()
void init_all(void)
{
/* for printf() numeric thousands separator */
setlocale(LC_NUMERIC, "");
@@ -37,6 +37,6 @@ void init_all()
/* zobrist tables & default tt hashtable */
zobrist_init();
hash_create(HASH_DEFAULT);
hash_create(HASH_SIZE_DEFAULT);
}

View File

@@ -32,10 +32,7 @@ int main(int __unused ac, __unused char**av)
movelist_t pseudo;
move_t move;
setlinebuf(stdout); /* line-buffered stdout */
bitboard_init();
hyperbola_init();
init_all();
while ((fen = next_fen(MOVEDO))) {
test_line = cur_line();

View File

@@ -277,17 +277,14 @@ int main(int __unused ac, __unused char**av)
// run = atoi(av[2]) & 3;
printf("depth = %d run = %x sf = %s\n", depth, run, sf_run? "true": "false");
init_all();
if (!run)
exit(0);
setlocale(LC_NUMERIC, "");
setlinebuf(stdout); /* line-buffered stdout */
if (sf_run)
outfd = open_stockfish();
bitboard_init();
hyperbola_init();
CLOCK_DEFINE(clock, CLOCK_PROCESS);
while ((fen = next_fen(PERFT | MOVEDO))) {
test_line = cur_line();