From ccc0dfd2f60d3958b38e4cf894e7d05d7632e418 Mon Sep 17 00:00:00 2001 From: Bruno Raoult Date: Thu, 22 Feb 2024 09:37:02 +0100 Subject: [PATCH] temp commit for machine transfer --- Makefile | 2 +- src/movegen.c | 13 ++++++++++++- test/movegen-test.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 test/movegen-test.c diff --git a/Makefile b/Makefile index 1395b51..82024f2 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ LIBS := $(strip -l$(LIB) -lreadline) CPPFLAGS := -I$(BRINCDIR) -I$(INCDIR) CPPFLAGS += -DBUG_ON CPPFLAGS += -DWARN_ON -CPPFLAGS += -NDEBUG # +CPPFLAGS += -DNDEBUG #CPPFLAGS += -DDEBUG # global CPPFLAGS += -DDEBUG_DEBUG # enable log() functions diff --git a/src/movegen.c b/src/movegen.c index 7cdc754..fa81f89 100644 --- a/src/movegen.c +++ b/src/movegen.c @@ -25,7 +25,10 @@ /** * gen_all_pseudomoves() - generate all pseudo moves + * @pos: position * + * Generate all moves, no check is done on validity due to castle rules, + * or check (pinned pieces, etc...). */ int gen_all_pseudomoves(pos_t *pos) { @@ -70,5 +73,13 @@ int gen_all_pseudomoves(pos_t *pos) bit_for_each64(to, tmp2, movebits) { moves.move[moves.nmoves++] = move_make(from, to); } - /* TODO */ + + /* TODO + * pawn ranks 2-6 advance (1 push, + 2 squares for rank 2) + * pawns ranks 2-6 capture + * pawns rank 7 advance + promotion + * pawns rank 7 capture + promotion + * pawns en-passant + * castle + */ } diff --git a/test/movegen-test.c b/test/movegen-test.c new file mode 100644 index 0000000..1bd0fc6 --- /dev/null +++ b/test/movegen-test.c @@ -0,0 +1,38 @@ +//#include "debug.h" +//#include "pool.h" + +#include +#include + +#include "../src/position.h" +#include "../src/piece.h" +#include "../src/bitboard.h" +#include "../src/hyperbola-quintessence.h" + +int main(int __unused ac, __unused char**av) +{ + char str[256]; + bitboard_init(); + hyperbola_init(); + for (int i = 0; i < 64; ++i) { + sprintf(str, "\n%#x:\n %-22s%-22s%-22s%-22s%-22s%-22s%-22s", i, + "sliding", "diagonal", "antidiagonal", "file", "rank", "knight", + "king" + ); + bitboard_print_multi(str, 7, + bb_file[i] | bb_rank[i] | + bb_diagonal[i] | bb_antidiagonal[i], + bb_diagonal[i], bb_antidiagonal[i], + bb_file[i], bb_rank[i], + bb_knight[i], bb_king[i]); + } + /* + * for (square_t sq = 0; sq < 64; ++sq) { + * sprintf(str, "%2d %#lx %#lx knight", sq, bb_sq[sq], bb_knight[sq]); + * bitboard_print(str, bb_knight[sq]); + * sprintf(str, "%2d %#lx %#lx knight", sq, bb_sq[sq], bb_king[sq]); + * bitboard_print(str, bb_king[sq]); + * } + */ + return 0; +}