xref: /csrg-svn/games/chess/move.h (revision 41195)
1*41195Sbostic /* header file for move generator hes 890318
2*41195Sbostic    Modified: 890510 minor bug fixed in Newataks
3*41195Sbostic              890606 NEWMOVE levels 1-6 */
4*41195Sbostic 
5*41195Sbostic #if (NEWMOVE >= 1)
6*41195Sbostic extern short distdata[64][64];
7*41195Sbostic extern short taxidata[64][64];
8*41195Sbostic 
9*41195Sbostic #define taxicab(a,b) taxidata[a][b]
10*41195Sbostic #define distance(a,b) distdata[a][b]
11*41195Sbostic 
12*41195Sbostic extern void Initialize_dist();
13*41195Sbostic #endif
14*41195Sbostic 
15*41195Sbostic #if (NEWMOVE >= 2)
16*41195Sbostic struct sqdata {
17*41195Sbostic   short nextpos;
18*41195Sbostic   short nextdir;
19*41195Sbostic };
20*41195Sbostic extern struct sqdata posdata[3][8][64][64];
21*41195Sbostic 
22*41195Sbostic extern void Initialize_moves();
23*41195Sbostic 
24*41195Sbostic #define ataks(side,a)\
25*41195Sbostic {\
26*41195Sbostic   register short u,c,sq;\
27*41195Sbostic   register struct sqdata *p;\
28*41195Sbostic   short i,piece,*PL;\
29*41195Sbostic   \
30*41195Sbostic   for (u = 64; u; a[--u] = 0); \
31*41195Sbostic   PL = PieceList[side];\
32*41195Sbostic   for (i = 0; i <= PieceCnt[side]; i++)\
33*41195Sbostic     {\
34*41195Sbostic       sq = PL[i];\
35*41195Sbostic       piece = board[sq];\
36*41195Sbostic       c = control[piece];\
37*41195Sbostic       p = posdata[side][piece][sq];\
38*41195Sbostic       if (piece == pawn) {\
39*41195Sbostic 	u = p[sq].nextdir; /* follow captures thread */\
40*41195Sbostic 	while (u != sq) {\
41*41195Sbostic 	  a[u] = ++a[u] | c;\
42*41195Sbostic 	  u = p[u].nextdir;\
43*41195Sbostic 	}\
44*41195Sbostic       }\
45*41195Sbostic       else {\
46*41195Sbostic 	u = p[sq].nextpos;\
47*41195Sbostic 	while (u != sq) {\
48*41195Sbostic           a[u] = ++a[u] | c;\
49*41195Sbostic 	  if (color[u] == neutral)\
50*41195Sbostic 	    u = p[u].nextpos;\
51*41195Sbostic 	  else\
52*41195Sbostic 	    u = p[u].nextdir;\
53*41195Sbostic 	}\
54*41195Sbostic       }\
55*41195Sbostic     }\
56*41195Sbostic }
57*41195Sbostic #endif
58*41195Sbostic 
59*41195Sbostic #if (NEWMOVE >= 3)
60*41195Sbostic extern short PieceList[2][16];
61*41195Sbostic 
62*41195Sbostic extern int Sqatakd();
63*41195Sbostic #endif
64*41195Sbostic 
65*41195Sbostic #if (NEWMOVE > 3)
66*41195Sbostic extern short Kfield[2][64],PINVAL,control[7],hung[2],XRAY;
67*41195Sbostic 
68*41195Sbostic extern BRscan();
69*41195Sbostic #endif
70*41195Sbostic 
71*41195Sbostic #if (NEWMOVE > 4)
72*41195Sbostic #define valueQ 1100
73*41195Sbostic 
74*41195Sbostic extern short PieceCnt[2],value[7],svalue[64];
75*41195Sbostic 
76*41195Sbostic extern CaptureList();
77*41195Sbostic #endif
78*41195Sbostic 
79*41195Sbostic #if (NEWMOVE > 5)
80*41195Sbostic extern GenMoves();
81*41195Sbostic #endif
82