alg1_board.h

Go to the documentation of this file.
00001 /***********************************************************************************
00002 * Filename      $RCSfile: alg1_board.h,v $
00003 * Current CVS       $Revision: 1.10 $
00004 * Checked-in by     $Author: yves $ 
00005 *
00006 * $Log: alg1_board.h,v $
00007 * Revision 1.10  2005/03/28 22:27:02  yves
00008 * Add typedef for position
00009 *
00010 * Revision 1.9  2004/12/24 01:25:34  yves
00011 * Opening book in binary mode implemented.
00012 * Version 0.2.6
00013 *
00014 * Revision 1.6  2004/12/18 11:53:10  yves
00015 * add ep move
00016 *
00017 * Revision 1.5  2004/12/18 10:48:23  yves
00018 * Move boardmapper and applymove to board source
00019 *
00020 * Revision 1.4  2004/12/17 17:35:30  yves
00021 * copy from search
00022 *
00023 * Revision 1.3  2004/12/16 03:02:07  yves
00024 * Change to bitfields
00025 *
00026 * Revision 1.2  2004/12/16 00:18:25  yves
00027 * Standard CVS command tags added
00028 * FEN notation inverted, now uppercase is white and lowercase is black
00029 *
00030 *
00031 ***********************************************************************************/
00032 
00033 #if !defined(__ALG1_BOARD_H__)
00034 #define __ALG1_BOARD_H__
00035 
00036 #include "belofte.h"
00037 #include "board.h"
00038 
00039 /*
00040  *          a   b   c   d   e   f   g   h
00041  *  132 133 134 135 136 137 138 139 140 141 142 143
00042  *  120
00043  *  108 109 110 111 112 113 114 115 116 117 118 119     - row 8
00044  *  96  97  98  99  100 101 102 103 104 105 106 107     - row 7
00045  *  84
00046  *  72
00047  *  60
00048  *  48
00049  *  36  37  38  39  40  41  42  43  44  45  46  47      - row 2
00050  *  24  25  26  27  28  29  30  31  32  33  34  35      - row 1
00051  *  12  13  14  15  16  17  18  19  20  21  22  23
00052  *  0   1   2   3   4   5   6   7   8   9   10  11
00053  *          a   b   c   d   e   f   g   h
00054  */
00055 
00056 // positions where the board itself starts and ends
00057 #define STARTPOS 26
00058 #define ENDPOS   118
00059 #define KINGWHITESTART 30
00060 #define KINGBLACKSTART 114
00061 
00062 #define BOARDARRAY_SIZE 144
00063 
00064 // --------------------------------------------------------------------
00065 
00066 #define M1_LIJN(x) ((x) % 8)
00067 #define M1_RIJ(x) ((x) / 8)
00068 
00069 // --------------------------------------------------------------------
00070 
00071 #define MAP144TO64(x) (m1_boardmapper.m_fields[(x)])
00072 #define ROW144TO64(x) (m1_boardmapper.m_fields[(x)] / 8)
00073 #define COL144TO64(x) (m1_boardmapper.m_fields[(x)] % 8)
00074 
00075 // --------------------------------------------------------------------
00076 
00077 struct st_alg1_board {
00078     t_field m_fields[BOARDARRAY_SIZE];  // fields as described above
00079     posid m_whiteking;              // king position
00080     posid m_blackking;  
00081     byte m_whitecastlescore;        // score data for improving evaluation
00082     byte m_blackcastlescore;
00083     byte m_whitecastle[2];          // short and long castle possible
00084     byte m_blackcastle[2];          
00085     byte m_whitebegin[8];           // pieces on begin position
00086     byte m_blackbegin[8];           
00087     posid m_epfield;                // field where ep is possible, 0 if none
00088     byte m_rule50;                  // number of plies since last capture or pawn move
00089 };
00090 
00091 // --------------------------------------------------------------------
00092 
00093 enum tCastleFlags { CASTLE_LONG = 0, CASTLE_SHORT };
00094 
00095 // --------------------------------------------------------------------
00096 
00097 typedef struct st_alg1_board    t_alg1_board;
00098 
00099 // --------------------------------------------------------------------
00100 
00101 void    apply_movewhite(const posid iFrom, const posid iTo, const t_promotion cFlag);
00102 void    apply_moveblack(const posid iFrom, const posid iTo, const t_promotion cFlag);
00103 
00104 // --------------------------------------------------------------------
00105 
00106 #endif

Generated on Tue Jan 31 00:14:05 2006 for BelofteDoc by  doxygen 1.4.6