stellar

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

CBoard.h (2239B)


      1 #ifndef CBOARD_H
      2 #define CBOARD_H
      3 
      4 #include "utils.h"
      5 
      6 enum enumCastle { WK = 1, WQ = 2, BK = 4, BQ = 8 };
      7 typedef enum enumCastle eCastle;
      8 
      9 typedef struct Piece_T *Piece_T;
     10 
     11 char   Piece_asci(Piece_T self);
     12 char   Piece_code(Piece_T self);
     13 char  *Piece_unicode(Piece_T self);
     14 eColor Piece_color(Piece_T self);
     15 ePiece Piece_piece(Piece_T self);
     16 int    Piece_index(Piece_T self);
     17 
     18 Piece_T Piece_get(ePiece piece, eColor color);
     19 Piece_T Piece_fromCode(char code);
     20 Piece_T Piece_fromIndex(int index);
     21 ePiece  Piece_piece_fromCode(int index);
     22 
     23 typedef struct CBoard_T *CBoard_T;
     24 
     25 CBoard_T CBoard_new(void);
     26 void     CBoard_free(CBoard_T *p);
     27 void     CBoard_copy(CBoard_T self, CBoard_T dest);
     28 
     29 U64     CBoard_colorBB(CBoard_T self, eColor color);
     30 U64     CBoard_occupancy(CBoard_T self);
     31 U64     CBoard_pieceBB(CBoard_T self, ePiece piece);
     32 eCastle CBoard_castle(CBoard_T self);
     33 eColor  CBoard_side(CBoard_T self);
     34 
     35 Square CBoard_enpassant(CBoard_T self);
     36 void   CBoard_enpassant_set(CBoard_T self, Square target);
     37 
     38 U64  CBoard_pieceSet(CBoard_T self, Piece_T piece);
     39 U64  CBoard_piece_attacks(CBoard_T self, Piece_T Piece, Square src);
     40 void CBoard_piece_capture(CBoard_T self, Piece_T Piece, Piece_T Taken, Square source, Square target);
     41 void CBoard_piece_move(CBoard_T self, Piece_T Piece, Square square,
     42                        Square target);
     43 void CBoard_piece_pop(CBoard_T self, Piece_T Piece, Square square);
     44 void CBoard_piece_set(CBoard_T self, Piece_T Piece, Square square);
     45 int  CBoard_piece_get(CBoard_T self, Square square);
     46 
     47 U64  CBoard_colorBB_get(CBoard_T self, eColor color, Square target);
     48 void CBoard_colorBB_pop(CBoard_T self, eColor color, Square target);
     49 void CBoard_colorBB_set(CBoard_T self, eColor color, Square target);
     50 
     51 void CBoard_castle_and(CBoard_T self, int exp);
     52 void CBoard_castle_pop(CBoard_T self, eCastle castle);
     53 
     54 Piece_T CBoard_square_piece(CBoard_T self, Square square, eColor side);
     55 int     CBoard_square_isAttack(CBoard_T self, Square square, eColor side);
     56 int     CBoard_square_isOccupied(CBoard_T self, Square square);
     57 
     58 CBoard_T CBoard_fromFEN(CBoard_T board, char *fen);
     59 int      CBoard_isCheck(CBoard_T self);
     60 void     CBoard_print(CBoard_T self);
     61 void     CBoard_side_switch(CBoard_T self);
     62 
     63 #endif