Compare commits
2 Commits
9b5c2253b1
...
movegen-re
Author | SHA1 | Date | |
---|---|---|---|
926dfa0765 | |||
374116b1e7 |
20
Makefile
20
Makefile
@@ -21,7 +21,7 @@ RMDIR := rmdir
|
||||
MAKE := make
|
||||
|
||||
SRCDIR := ./src
|
||||
INCDIR := ./src # used by ./test sources
|
||||
INCDIR := ./src # used by ./test sources
|
||||
OBJDIR := ./obj
|
||||
BINDIR := ./bin
|
||||
DEPDIR := ./dep
|
||||
@@ -34,13 +34,13 @@ BRLIBDIR := $(BRLIB)/lib
|
||||
CCLSROOT := .ccls-root
|
||||
CCLSFILE := compile_commands.json
|
||||
|
||||
SRC := $(wildcard $(SRCDIR)/*.c) # project sources
|
||||
SRC_FN := $(notdir $(SRC)) # source basename
|
||||
SRC := $(wildcard $(SRCDIR)/*.c) # project sources
|
||||
SRC_FN := $(notdir $(SRC)) # source basename
|
||||
OBJ := $(addprefix $(OBJDIR)/,$(SRC_FN:.c=.o))
|
||||
|
||||
TSTSRC := $(wildcard $(TSTDIR)/*.c)
|
||||
|
||||
LIB := br_$(shell uname -m) # library name
|
||||
LIB := br_$(shell uname -m) # library name
|
||||
LIBS := $(strip -l$(LIB) -lreadline)
|
||||
|
||||
DEP_FN := $(SRC_FN)
|
||||
@@ -63,16 +63,16 @@ CPPFLAGS += -DWARN_ON # brlib bug.h
|
||||
#CPPFLAGS += -DDEBUG_DEBUG # enable log() functions
|
||||
#CPPFLAGS += -DDEBUG_DEBUG_C # enable log() settings
|
||||
#CPPFLAGS += -DDEBUG_POOL # memory pools management
|
||||
#CPPFLAGS += -DDEBUG_POS # position.c
|
||||
#CPPFLAGS += -DDEBUG_POS # position.c
|
||||
#CPPFLAGS += -DDEBUG_MOVE # move generation
|
||||
|
||||
# fen.c
|
||||
#CPPFLAGS += -DDEBUG_FEN # FEN decoding
|
||||
|
||||
# attack.c
|
||||
#CPPFLAGS += -DDEBUG_ATTACK_ATTACKERS1 # sq_attackers details
|
||||
CPPFLAGS += -DDEBUG_ATTACK_ATTACKERS # sq_attackers
|
||||
CPPFLAGS += -DDEBUG_ATTACK_PINNERS # sq_pinners details
|
||||
#CPPFLAGS += -DDEBUG_ATTACK_ATTACKERS1 # sq_attackers details
|
||||
CPPFLAGS += -DDEBUG_ATTACK_ATTACKERS # sq_attackers
|
||||
CPPFLAGS += -DDEBUG_ATTACK_PINNERS # sq_pinners details
|
||||
|
||||
#CPPFLAGS += -DDEBUG_EVAL # eval functions
|
||||
#CPPFLAGS += -DDEBUG_PIECE # piece list management
|
||||
@@ -90,8 +90,8 @@ CFLAGS := -std=gnu11
|
||||
|
||||
# dev
|
||||
# CFLAGS += -O1
|
||||
CFLAGS += -g # symbols (gdb, perf, etc.)
|
||||
CFLAGS += -ginline-points # inlined funcs debug info
|
||||
CFLAGS += -g # symbols (gdb, perf, etc.)
|
||||
CFLAGS += -ginline-points # inlined funcs debug info
|
||||
# for gprof
|
||||
#CFLAGS += -pg
|
||||
# Next one may be useful for valgrind (when invalid instructions)
|
||||
|
@@ -201,9 +201,8 @@ void pos_set_checkers_pinners_blockers(pos_t *pos)
|
||||
bitboard_t occ = pos_occ(pos);
|
||||
bitboard_t attackers;
|
||||
bitboard_t checkers = 0, blockers = 0, pinners = 0;
|
||||
bitboard_t targets, tmpcheckers, maybeblockers, tmppinners, tmpbb;
|
||||
bitboard_t targets, tmpcheckers, maybeblockers, tmppinners;
|
||||
square_t king = pos->king[us];
|
||||
bitboard_t king_bb = mask(king);
|
||||
int pinner;
|
||||
|
||||
/* bishop type - we attack with a bishop from king position */
|
||||
@@ -216,7 +215,7 @@ void pos_set_checkers_pinners_blockers(pos_t *pos)
|
||||
tmpcheckers = targets & attackers;
|
||||
checkers |= tmpcheckers;
|
||||
|
||||
/* maybe blockers = not checkers */
|
||||
/* maybe blockers = we remove checkers, to look "behind" */
|
||||
maybeblockers = targets & ~tmpcheckers;
|
||||
|
||||
/* we find second targets, by removing first ones (excl. checkers) */
|
||||
@@ -252,13 +251,9 @@ void pos_set_checkers_pinners_blockers(pos_t *pos)
|
||||
}
|
||||
}
|
||||
|
||||
/* pawns */
|
||||
/* pawns & knights */
|
||||
checkers |= bb_pawn_attacks[us][king] & pos->bb[them][PAWN];
|
||||
|
||||
/* knight */
|
||||
attackers = pos->bb[them][KNIGHT];
|
||||
targets = bb_knight[king] & attackers;
|
||||
checkers |= targets;
|
||||
checkers |= bb_knight[king] & pos->bb[them][KNIGHT];
|
||||
|
||||
pos->checkers = checkers;
|
||||
pos->pinners = pinners;
|
||||
|
@@ -299,6 +299,8 @@ int main(int __unused ac, __unused char**av)
|
||||
pos_del(savepos);
|
||||
pos_del(pos);
|
||||
i++;
|
||||
/* to run first test only */
|
||||
// exit(0);
|
||||
}
|
||||
if (run & 1)
|
||||
printf("total perft %'ldms\n", ms1_total);
|
||||
|
Reference in New Issue
Block a user