summaryrefslogtreecommitdiff
path: root/gnu/games/chess/move.h
blob: c309a5ff0deba303f3079bda12376c8de7bc5693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/*	$Id: move.h,v 1.1 1995/10/18 08:41:11 deraadt Exp $ */

/* header file for move generator hes 890318
   Modified: 890510 minor bug fixed in Newataks
             890606 NEWMOVE levels 1-6 */

#if (NEWMOVE >= 1)
extern short distdata[64][64];
extern short taxidata[64][64];

#define taxicab(a,b) taxidata[a][b]
#define distance(a,b) distdata[a][b]

extern void Initialize_dist();
#endif
  
#if (NEWMOVE >= 2)
struct sqdata {
  short nextpos;
  short nextdir;
};
extern struct sqdata posdata[3][8][64][64];

extern void Initialize_moves();

#define ataks(side,a)\
{\
  register short u,c,sq;\
  register struct sqdata *p;\
  short i,piece,*PL;\
  \
  for (u = 64; u; a[--u] = 0); \
  PL = PieceList[side];\
  for (i = 0; i <= PieceCnt[side]; i++)\
    {\
      sq = PL[i];\
      piece = board[sq];\
      c = control[piece];\
      p = posdata[side][piece][sq];\
      if (piece == pawn) {\
	u = p[sq].nextdir; /* follow captures thread */\
	while (u != sq) {\
	  a[u] = ++a[u] | c;\
	  u = p[u].nextdir;\
	}\
      }\
      else {\
	u = p[sq].nextpos;\
	while (u != sq) {\
          a[u] = ++a[u] | c;\
	  if (color[u] == neutral)\
	    u = p[u].nextpos;\
	  else\
	    u = p[u].nextdir;\
	}\
      }\
    }\
}
#endif

#if (NEWMOVE >= 3)
extern short PieceList[2][16];

extern int Sqatakd();
#endif

#if (NEWMOVE > 3)
extern short Kfield[2][64],PINVAL,control[7],hung[2],XRAY;

extern BRscan();
#endif

#if (NEWMOVE > 4)
#define valueQ 1100

extern short PieceCnt[2],value[7],svalue[64];

extern CaptureList();
#endif

#if (NEWMOVE > 5)
extern GenMoves();
#endif