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