#include "chess/move.h" #include "chess/types.h" #include #include #include void printerll(FILE *file, long long num) { fprintf(file, "%lld", num); } void printerull(FILE *file, unsigned long long num) { fprintf(file, "%lluu", num); } // for debugging void printPieceMask(uint_least64_t mask) { for(uint_least8_t i = 0; i < BOARD_SIZE; ++i, mask >>= BOARD_SIZE) { for(uint_least8_t j = 0; j < BOARD_SIZE; ++j) { printf("%d ", bitsetGet(mask, j)); } printf("\n"); } } void fieldToString(uint_least8_t field, char *output) { output[0] = 'a' + field % BOARD_SIZE; output[1] = '0' + BOARD_SIZE - field / BOARD_SIZE; output[2] = '\0'; } void printMove(const struct move_t move) { char src[3]; char dst[3]; fieldToString(move.src, src); fieldToString(move.dst, dst); printf("%s%s", src, dst); if(move.srcPiece != move.dstPiece) { char piece; switch(move.dstPiece) { case ROOK: piece = 'R'; break; case BISHOP: piece = 'B'; break; case QUEEN: piece = 'Q'; break; case KNIGHT: piece = 'N'; break; } printf("%c", piece); } }