/** A quick test script to debug and visually inspect functions and operations. */ #include #include #include "bitboard.h" #include "fen.h" static int popcount64(uint64_t x){ int c=0; while(x){ x&=x-1; ++c; } return c; } static const char NAME[12] = {'P','N','B','R','Q','K','p','n','b','r','q','k'}; int main(void) { const char *fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; struct Board b; int rc = load_fen(&b, fen); for (int i=0;i<12;i++) printf("%c: %d\n", NAME[i], popcount64(b.pieces[i])); if (rc != 0) { fprintf(stderr, "load_fen failed (rc=%d) for FEN:\n%s\n", rc, fen); return 1; } print_board(&b); return 0; }