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 # fen.c
#CPPFLAGS += -DDEBUG_FEN # FEN decoding #CPPFLAGS += -DDEBUG_FEN # FEN decoding
# hash
CPPFLAGS += -DDEBUG_HASH # chk zobrist consistency
# attack.c # attack.c
#CPPFLAGS += -DDEBUG_ATTACK_ATTACKERS # sq_attackers #CPPFLAGS += -DDEBUG_ATTACK_ATTACKERS # sq_attackers
#CPPFLAGS += -DDEBUG_ATTACK_PINNERS # sq_pinners details #CPPFLAGS += -DDEBUG_ATTACK_PINNERS # sq_pinners details
@@ -342,12 +345,12 @@ TEST += movedo-test perft-test
PIECE_OBJS := piece.o PIECE_OBJS := piece.o
FEN_OBJS := $(PIECE_OBJS) fen.o position.o bitboard.o board.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) BB_OBJS := $(FEN_OBJS)
MOVEGEN_OBJS := $(BB_OBJS) move.o move-gen.o MOVEGEN_OBJS := $(BB_OBJS) move.o move-gen.o
ATTACK_OBJS := $(MOVEGEN_OBJS) ATTACK_OBJS := $(MOVEGEN_OBJS)
MOVEDO_OBJS := $(ATTACK_OBJS) move-do.o hash.o MOVEDO_OBJS := $(ATTACK_OBJS) move-do.o misc.o
PERFT_OBJS := $(MOVEDO_OBJS) search.o misc.o PERFT_OBJS := $(MOVEDO_OBJS) search.o
TEST := $(addprefix $(BINDIR)/,$(TEST)) 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) bin/movedo-test: test/movedo-test.c test/common-test.h $(MOVEDO_OBJS)
@echo compiling $@ test executable. @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) bin/perft-test: test/perft-test.c test/common-test.h $(PERFT_OBJS)
@echo compiling $@ test executable. @echo compiling $@ test executable.

View File

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

View File

@@ -21,7 +21,7 @@
#include "hash.h" #include "hash.h"
void init_all() void init_all(void)
{ {
/* for printf() numeric thousands separator */ /* for printf() numeric thousands separator */
setlocale(LC_NUMERIC, ""); setlocale(LC_NUMERIC, "");
@@ -37,6 +37,6 @@ void init_all()
/* zobrist tables & default tt hashtable */ /* zobrist tables & default tt hashtable */
zobrist_init(); 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; movelist_t pseudo;
move_t move; move_t move;
setlinebuf(stdout); /* line-buffered stdout */ init_all();
bitboard_init();
hyperbola_init();
while ((fen = next_fen(MOVEDO))) { while ((fen = next_fen(MOVEDO))) {
test_line = cur_line(); test_line = cur_line();

View File

@@ -277,17 +277,14 @@ int main(int __unused ac, __unused char**av)
// run = atoi(av[2]) & 3; // run = atoi(av[2]) & 3;
printf("depth = %d run = %x sf = %s\n", depth, run, sf_run? "true": "false"); printf("depth = %d run = %x sf = %s\n", depth, run, sf_run? "true": "false");
init_all();
if (!run) if (!run)
exit(0); exit(0);
setlocale(LC_NUMERIC, "");
setlinebuf(stdout); /* line-buffered stdout */
if (sf_run) if (sf_run)
outfd = open_stockfish(); outfd = open_stockfish();
bitboard_init();
hyperbola_init();
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();