stellar

Stellar - Chess engine written in C
Log | Files | Refs

board.h (1714B)


      1 #ifndef STELLAR_BOARD_H
      2 #define STELLAR_BOARD_H
      3 
      4 #include "piece.h"
      5 
      6 enum enumCastle {
      7     WK = 1,
      8     WQ = 2,
      9     BK = 4,
     10     BQ = 8
     11 };
     12 typedef enum enumCastle eCastle;
     13 
     14 typedef struct Board Board;
     15 struct Board {
     16     U64 color[2];
     17     U64 piece[6];
     18     U64 hash;
     19     eColor side;
     20     Square enpassant;
     21     eCastle castle;
     22 };
     23 
     24 Board *board_new(void);
     25 void board_free(Board **p);
     26 void board_copy(const Board *self, Board *dest);
     27 
     28 U64 board_color(const Board *self, eColor color);
     29 U64 board_occupancy(const Board *self);
     30 U64 board_piece(const Board *self, ePiece piece);
     31 eCastle board_castle(const Board *self);
     32 eColor board_side(const Board *self);
     33 Square board_enpassant(const Board *self);
     34 U64 board_hash(const Board *self);
     35 
     36 void board_side_switch(Board *self);
     37 void board_enpassant_set(Board *self, Square target);
     38 void board_castle_and(Board *self, int exp);
     39 
     40 U64 board_pieceSet(const Board *self, Piece piece);
     41 U64 board_piece_attacks(const Board *self, Piece piece, Square src);
     42 
     43 void board_piece_pop(Board *self, Piece Piece, Square square);
     44 void board_piece_set(Board *self, Piece Piece, Square square);
     45 int board_piece_get(const Board *self, Square square);
     46 
     47 U64 board_color_get(const Board *self, eColor color, Square target);
     48 void board_color_pop(Board *self, eColor color, Square target);
     49 void board_color_set(Board *self, eColor color, Square target);
     50 
     51 Piece board_square_piece(const Board *self, Square square, eColor side);
     52 int board_square_isAttack(const Board *self, Square square, eColor side);
     53 int board_square_isOccupied(const Board *self, Square square);
     54 
     55 Board *board_from_FEN(Board *board, const char *fen);
     56 int board_isCheck(const Board *self);
     57 void board_print(const Board *self);
     58 
     59 #endif