From 2c2a70b69869f149c0407a62f1bf4c39899027a7 Mon Sep 17 00:00:00 2001 From: Aargh Rai Date: Wed, 27 May 2026 18:02:44 +0530 Subject: restructing --- src/bitboard.c | 75 ---------------------------------------------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/bitboard.c (limited to 'src/bitboard.c') diff --git a/src/bitboard.c b/src/bitboard.c deleted file mode 100644 index 4746020..0000000 --- a/src/bitboard.c +++ /dev/null @@ -1,75 +0,0 @@ -#include "bitboard.h" -#include -#include -#include - -position_t position_starting() { - return (position_t) { - .bitboards = { - 16ULL, - 8ULL, - 129ULL, - 36ULL, - 66ULL, - 65280ULL, - 1152921504606846976ULL, - 576460752303423488ULL, - 9295429630892703744ULL, - 2594073385365405696ULL, - 4755801206503243776ULL, - 71776119061217280ULL, - }, - .castling = - ((bitboard_t)1 << WHITE_SHORT_CASTLE) | - ((bitboard_t)1 << WHITE_LONG_CASTLE) | - ((bitboard_t)1 << BLACK_SHORT_CASTLE) | - ((bitboard_t)1 << BLACK_LONG_CASTLE), - .turn = WHITE_TURN, - .passantable_file = 0, - }; -} - -void assert_valid_position(position_t position) { - assert(position.castling <= - ( - ((bitboard_t)1 << WHITE_SHORT_CASTLE) | - ((bitboard_t)1 << WHITE_LONG_CASTLE) | - ((bitboard_t)1 << BLACK_SHORT_CASTLE) | - ((bitboard_t)1 << BLACK_LONG_CASTLE) - ) - ); - assert(position.turn == WHITE_TURN || position.turn == BLACK_TURN); - assert(position.passantable_file <= 8); - assert(position.bitboards[WHITE_KING] != 0); - assert(position.bitboards[BLACK_KING] != 0); -} - -bitboard_t whites(position_t position) { - return - position.bitboards[WHITE_KING] | - position.bitboards[WHITE_QUEEN] | - position.bitboards[WHITE_ROOK] | - position.bitboards[WHITE_BISHOP] | - position.bitboards[WHITE_KNIGHT] | - position.bitboards[WHITE_PAWN]; -} - -bitboard_t blacks(position_t position) { - return - position.bitboards[BLACK_KING] | - position.bitboards[BLACK_QUEEN] | - position.bitboards[BLACK_ROOK] | - position.bitboards[BLACK_BISHOP] | - position.bitboards[BLACK_KNIGHT] | - position.bitboards[BLACK_PAWN]; -} - -void print_bitboard(bitboard_t bitboard) { - printf("Bitboard(%" PRIu64 ")\n", bitboard); - for (int i = 7; i >= 0; i--) { - for (int j = 0; j < 8; j++) { - printf("%" PRIu64 "", (bitboard >> (8 * i + j)) & 1); - } - printf("\n"); - } -} -- cgit v1.2.3