bpaul-chess

UCI chess engine to replace Omelette Chess Engine
Log | Files | Refs | README | LICENSE

pos.h (753B)


      1 #pragma once
      2 
      3 #include "bb.h"
      4 
      5 enum sides { WHITE, BLACK, SIDE_CNT };
      6 
      7 enum pieces { PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING, PIECE_CNT };
      8 
      9 struct pos {
     10 	bb sides[SIDE_CNT];
     11 	bb pieces[PIECE_CNT];
     12 
     13     /* Only need one bit, either white or black */
     14 	char turn : 1;
     15 
     16     /* Each bit represents one of the castling rules, a bit for whether white
     17      * can kingside castle, one for queenside castling, and a bit for black for
     18      * each too */
     19     char castle : 4;
     20 
     21     /* enpas refers to the square that a double pushed pawn moves to. Since
     22      * there are 64 squares, 6 bits are needed */
     23     char enpas : 6;
     24 
     25     /* Tracker for 50 move rule */
     26     unsigned char fifty;
     27 
     28     /* Track game length (hence the name) */
     29     unsigned short game_length;
     30 };