diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-07-10 16:01:57 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-07-10 16:01:57 +0530 |
| commit | a14da2fe3864712dab4e7c4cfb5c323026d668de (patch) | |
| tree | 418c8c8ff44a611cbe1c1269b10926527046e232 /src/bitboard.h | |
| parent | 2761f8a533e2b025f209222a1e4ec70b91c7e8ee (diff) | |
moving header files to include directory & moving resources in it's own directory
i know currently there is race condition, but the code is getting too
messy, i will continue to this after i make a vis tool to analyse how i
should split up files & stuff
the code rn needs intense restructing for it to make any more progress
Diffstat (limited to 'src/bitboard.h')
| -rw-r--r-- | src/bitboard.h | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/src/bitboard.h b/src/bitboard.h deleted file mode 100644 index ecd8c35..0000000 --- a/src/bitboard.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef BITBOARD_H -#define BITBOARD_H - -#include "ints.h" -#include <stdbool.h> - -typedef u64 bitboard_t; - -enum { - WHITE_KING, - WHITE_QUEEN, - WHITE_ROOK, - WHITE_BISHOP, - WHITE_KNIGHT, - WHITE_PAWN, - BLACK_KING, - BLACK_QUEEN, - BLACK_ROOK, - BLACK_BISHOP, - BLACK_KNIGHT, - BLACK_PAWN, - PIECE_TYPE_COUNT, -}; - -enum { - WHITE_SHORT_CASTLE = 1 << 0, - WHITE_LONG_CASTLE = 1 << 1, - BLACK_SHORT_CASTLE = 1 << 2, - BLACK_LONG_CASTLE = 1 << 3, -}; - -enum { - WHITE_TURN, - BLACK_TURN, -}; - -#define BITMASK_RANK_1 255ULL -#define BITMASK_RANK_2 65280ULL -#define BITMASK_RANK_3 16711680ULL -#define BITMASK_RANK_4 4278190080ULL -#define BITMASK_RANK_5 1095216660480ULL -#define BITMASK_RANK_6 280375465082880ULL -#define BITMASK_RANK_7 71776119061217280ULL -#define BITMASK_RANK_8 18374686479671623680ULL -#define BITMASK_FILE_A 72340172838076673ULL -#define BITMASK_FILE_B 144680345676153346ULL -#define BITMASK_FILE_C 289360691352306692ULL -#define BITMASK_FILE_D 578721382704613384ULL -#define BITMASK_FILE_E 1157442765409226768ULL -#define BITMASK_FILE_F 2314885530818453536ULL -#define BITMASK_FILE_G 4629771061636907072ULL -#define BITMASK_FILE_H 9259542123273814144ULL - -#define occupied_by(bitboard, index) (bitboard & ((bitboard_t)1 << index)) - -typedef struct { - bitboard_t bitboards[PIECE_TYPE_COUNT]; - u8 castling; - u8 turn; - u8 passantable_file; - u16 halfmove_clock; - u16 fullmove_clock; -} position_t; - -position_t position_starting(); -void assert_valid_position(position_t position); -bool check_valid_position(position_t position); -#define whites(position) \ - position.bitboards[WHITE_KING] | \ - position.bitboards[WHITE_QUEEN] | \ - position.bitboards[WHITE_ROOK] | \ - position.bitboards[WHITE_BISHOP] | \ - position.bitboards[WHITE_KNIGHT] | \ - position.bitboards[WHITE_PAWN] - -#define blacks(position) \ - 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); - -#endif // BITBOARD_H |
