00001 /*********************************************************************************** 00002 * Filename $RCSfile: board.h,v $ 00003 * Current CVS $Revision: 1.16 $ 00004 * Checked-in by $Author: yves $ 00005 * 00006 * $Log: board.h,v $ 00007 * Revision 1.16 2004/12/24 01:25:34 yves 00008 * Opening book in binary mode implemented. 00009 * Version 0.2.6 00010 * 00011 * Revision 1.15 2004/12/21 00:43:10 yves 00012 * opening book implemented 00013 * 00014 * Revision 1.12 2004/12/18 11:53:10 yves 00015 * add ep move 00016 * 00017 * Revision 1.11 2004/12/17 23:38:38 yves 00018 * sidetomove has to be a 2 bit bitfield 00019 * 00020 * Revision 1.10 2004/12/17 17:37:37 yves 00021 * move from search 00022 * 00023 * Revision 1.9 2004/12/16 03:03:09 yves 00024 * Change to bitfields 00025 * Add SAN moves in history, will be used for opening book handling 00026 * 00027 * Revision 1.8 2004/12/16 00:18:25 yves 00028 * Standard CVS command tags added 00029 * FEN notation inverted, now uppercase is white and lowercase is black 00030 * 00031 * 00032 ***********************************************************************************/ 00033 00034 #if !defined(__BOARD_H__) 00035 #define __BOARD_H__ 00036 00037 #include "belofte.h" 00038 00039 // -------------------------------------------------------------------- 00040 00041 struct st_board 00042 { 00043 t_field m_fields[8][8]; // board representation 00044 t_flag m_piecemoved[2][2]; // storage for rooks if moved (or both if king moved) 00045 t_ply m_ply; // ply number in the game 00046 t_ply m_rule50; // number since last pawn move or capture 00047 posid m_epfield; // where can an ep move take place, 0 if none? 00048 t_colour m_sidetomove:2; // colour of player to move 00049 } ; 00050 00051 typedef struct st_board t_board; 00052 00053 // structure containing membuffer with board and all moves and representations of each move played 00054 // used for undo and 00055 00056 struct st_history { 00057 char szSANMove[MAX_MOVE_LENGTH]; 00058 char szIntMove[MAX_MOVE_LENGTH]; 00059 char szFEN[MAX_FEN_LENGTH]; 00060 t_board m_board; 00061 } ; 00062 00063 // board layout is left bottum index = 0, right bottom = 7, left top = 56, right top = 63 00064 // board element is n_field[column][row] 00065 00066 // -------------------------------------------------------------------- 00067 00068 enum tPiece { FIELD_EMPTY = ' ' , 00069 PIECE_BISHOP = 'B' , 00070 PIECE_KING = 'K' , 00071 PIECE_KNIGHT = 'N' , 00072 PIECE_PAWN = 'P' , 00073 PIECE_QUEEN = 'Q' , 00074 PIECE_ROOK = 'R' , 00075 BLACK_BISHOP = 'b' , 00076 BLACK_KING = 'k' , 00077 BLACK_KNIGHT = 'n' , 00078 BLACK_PAWN = 'p' , 00079 BLACK_QUEEN = 'q' , 00080 BLACK_ROOK = 'r' , 00081 FIELD_BORDER = '#' 00082 }; 00083 00084 typedef enum tPiece t_piece; 00085 00086 enum tPromotion { PROMOTION_NONE = 0, 00087 PROMOTION_QUEEN = PIECE_QUEEN, PROMOTION_ROOK = PIECE_ROOK, 00088 PROMOTION_KNIGHT = PIECE_KNIGHT, PROMOTION_BISHOP = PIECE_BISHOP }; 00089 00090 typedef enum tPromotion t_promotion; 00091 00092 #define LOWERCASEBIT ('a' - 'A') 00093 00094 // -------------------------------------------------------------------- 00095 00096 int board_getmetadata(const char *szFlag); 00097 int board_sanapplymove(char *szMove, char *szCoordMove); 00098 00099 // -------------------------------------------------------------------- 00100 00101 #endif