104 /**
105  * move_t will contain a src square (lowest 6 bits), a dest square (next 6
106  * bits), and several flags - is check, isenpassant, iscapture (and what
107  * piece type is captured), ispromotion (and what is promoted to), and
108  * also which color made the move.
109  * 000000000  III  HHH  G  F  E  D  C  BBBBBB AAAAAA
110  *         23   20   17 16 15 14 13 12      6      0
111  * A: Source square
112  * B: Dest square
113  * C: Color (which side is making this move)
114  * D: Castle
115  * E: En passant
116  * F: Capture
117  * G: Promotion
118  * H: Captured piece type (color will be the opposite of C)
119  * I: Promotion result piece type (color indicated by C)
120  * 0: Unused bits
121  */
122 typedef uint32_t move_t;
123 #define MOV_INDEX_SRC     0
124 #define MOV_INDEX_DEST    6
125 #define MOV_INDEX_COLOR  12
126 #define MOV_INDEX_CASTLE 13
127 #define MOV_INDEX_EP     14
128 #define MOV_INDEX_CAPT   15
129 #define MOV_INDEX_PROM   16
130 #define MOV_INDEX_CAPTPC 17
131 #define MOV_INDEX_PROMPC 20
132
133 #define MOV_SRC(m)    (((m) >> MOV_INDEX_SRC) & 0x3f)
134 #define MOV_DEST(m)   (((m) >> MOV_INDEX_DEST) & 0x3f)
135 #define MOV_COLOR(m)  (((m) >> MOV_INDEX_COLOR) & 0x1)
136 #define MOV_CASTLE(m) (((m) >> MOV_INDEX_CASTLE) & 0x1)
137 #define MOV_EP(m)     (((m) >> MOV_INDEX_EP) & 0x1)
138 #define MOV_CAPT(m)   (((m) >> MOV_INDEX_CAPT) & 0x1)
139 #define MOV_PROM(m)   (((m) >> MOV_INDEX_PROM) & 0x1)
140 #define MOV_CAPTPC(m) (((m) >> MOV_INDEX_CAPTPC) & 0x7)
141 #define MOV_PROMPC(m) (((m) >> MOV_INDEX_PROMPC) & 0x7)
Move pack description, from warriorness
Move pack description, from warriorness
