temp commit for machine transfer

This commit is contained in:
2024-02-22 09:37:02 +01:00
parent fa5c9bb8ab
commit ccc0dfd2f6
3 changed files with 51 additions and 2 deletions

View File

@@ -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

View File

@@ -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
*/
}

38
test/movegen-test.c Normal file
View File

@@ -0,0 +1,38 @@
//#include "debug.h"
//#include "pool.h"
#include <stdio.h>
#include <string.h>
#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;
}