home *** CD-ROM | disk | FTP | other *** search
/ Más de 2,500 Juegos / CD1.iso / ZIPDAT / 0153 / 0153.ZIP / SRC / GNUCHESS.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-08  |  23.0 KB  |  753 lines

  1. /*
  2.  * gnuchess.h - Header file for GNU CHESS for Windows
  3.  *
  4.  * Copyright (c) 1988,1989,1990 John Stanback
  5.  * Copyright (c) 1992 Free Software Foundation
  6.  * Modified by Conor McCarthy for the Windows environment
  7.  *
  8.  * This file is part of GNU CHESS.
  9.  *
  10.  * GNU Chess is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published by
  12.  * the Free Software Foundation; either version 2, or (at your option)
  13.  * any later version.
  14.  *
  15.  * GNU Chess is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with GNU Chess; see the file COPYING.  If not, write to
  22.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. #define NOATOM                /*Minimize windows.h processing*/
  26. #define NOCLIPBOARD
  27. #define NOCREATESTRUCT
  28. #define NOREGION
  29. #define NOSOUND
  30. #define NOWH
  31. #define NOCOMM
  32. #define NOKANJI
  33. #include <windows.h>
  34.  
  35. #define HAVE_MEMSET 1
  36. #define HAVE_STRTOUL 1
  37. #define SIGNCHAR 1
  38. #define BOOKSIZE 20000
  39. #define ttblsz 16001
  40. #define HISTORY 1
  41. #define KILLT 1
  42. #define AGING 1
  43. #define PRUNE 1
  44. #define NULLMOVE 1
  45. #define GDX 1
  46. #define WAY4PL64 1
  47. #define QUIETBOOKGEN 1
  48. #define CACHE 1
  49. #define HASHFILE "gnuchess.hsh"
  50. #define BINBOOK "gnuchess.dat"
  51. #define BINECO "gnuchess.eco"
  52. #define PGNECO "eco.pgn"
  53. #define LANGFILE "gnuchess.lan"
  54.  
  55. #ifndef __GNUC__
  56. #define inline
  57. #endif
  58.  
  59. #include <stdio.h>
  60. #ifdef HAVE_MEMSET
  61. #include <memory.h>
  62. #endif
  63. #ifdef SIGNCHAR
  64. typedef signed char CHAR;
  65. #else
  66. typedef char CHAR;
  67. #endif
  68. typedef unsigned char UCHAR;
  69. typedef short tshort;
  70. typedef unsigned short utshort;
  71. #ifdef USEINT
  72. typedef  int SHORT;
  73. typedef  unsigned int UTSHORT;
  74. #else
  75. typedef unsigned short UTSHORT;
  76. typedef short SHORT;
  77. #endif
  78.  
  79. #define SHORT int
  80. #define UTSHORT unsigned int
  81.  
  82. #ifndef SEEK_SET
  83. #define SEEK_SET 0
  84. #define SEEK_END 2
  85. #endif
  86.  
  87. #ifdef DEBUG
  88. void
  89. ShowDBLine (CHAR *, SHORT, SHORT,
  90.        SHORT, SHORT, SHORT,
  91.        utshort *);
  92.      extern FILE *debugfd;
  93.      extern SHORT debuglevel;
  94.  
  95. #endif /* DEBUG */
  96.  
  97. #include <ctype.h>
  98. #include <string.h>
  99. #include <stdlib.h>
  100.  
  101. #define HAVE_TIME_H
  102. #include <malloc.h>
  103. #define RWA_ACC "r+b"
  104. #define WA_ACC "w+b"
  105. #define printz printf
  106. #define scanz scanf
  107.  
  108. #ifdef HAVE_TIME_H
  109. #include <time.h>
  110. #endif
  111.  
  112.  
  113. /* Magic for those compilers that can't handle "huge" static structures... */
  114. /* Be sure to also invoke Initialize_mem() if you use this */
  115. #ifdef Think_C
  116. #define ALLOCATE(ms) if (!(_##ms=malloc(sizeof(ms)))) \
  117.         {perror(#ms);exit(1);}\
  118.         else printf("Allocate %s @ %ld, %ld bytes.\n", #ms, _##ms, sizeof(ms));
  119. /* #define etab (*_etab) */
  120. #define nextpos (*_nextpos)
  121. #define nextdir (*_nextdir)
  122. #define history (*_history)
  123. #define Tree (*_Tree)
  124. #endif /* Think_C */
  125.  
  126. /* Piece values */
  127. #define valueP 100
  128. #define valueN 350
  129. #define valueB 355
  130. #define valueR 550
  131. #define valueQ 1100
  132. #define valueK 1200
  133. /* masks into upper 8 bits of ataks array */
  134. #define ctlP 0x4000
  135. #define ctlN 0x2800
  136. #define ctlB 0x1800
  137. #define ctlR 0x0400
  138. #define ctlQ 0x0200
  139. #define ctlK 0x0100
  140. #define ctlBQ 0x1200
  141. #define ctlBN 0x0800
  142. #define ctlRQ 0x0600
  143. #define ctlNN 0x2000
  144. /* attack functions */
  145. #define Patak(c, u) (atak[c][u] > ctlP)
  146. #define Anyatak(c, u) (atak[c][u] > 0)
  147. /* distance function */
  148. #define taxicab(a,b) taxidata[a][b]
  149. /* king positions */
  150. #define wking PieceList[white][0]
  151. #define bking PieceList[black][0]
  152. #define EnemyKing PieceList[c2][0]
  153. /* constants */
  154. /* castle moves */
  155. #define BLACKCASTLE  0x3C3E
  156. #define WHITECASTLE  0x0406
  157. #define LONGBLACKCASTLE 0x3C3A
  158. #define LONGWHITECASTLE 0x0402
  159. /* truth values */
  160. #define false 0
  161. #define true 1
  162. /* colors */
  163. #define white 0
  164. #define black 1
  165. #define neutral 2
  166. /* piece code defines */
  167. #define no_piece 0
  168. #define pawn 1
  169. #define knight 2
  170. #define bishop 3
  171. #define rook 4
  172. #define queen 5
  173. #define king 6
  174. #define bpawn 7
  175. /* node flags */
  176. #define pmask 0x0007
  177. #define promote 0x0008
  178. #define cstlmask 0x0010
  179. #define epmask 0x0020
  180. #define exact 0x0040
  181. #define pwnthrt 0x0080
  182. #define check 0x0100
  183. #define capture 0x0200
  184. #define draw 0x0400
  185. #define book 0x1000
  186. /* move symbols */
  187. #define pxx (CP[2])
  188. #define qxx (CP[1])
  189. #define rxx (CP[60])
  190. #define cxx (CP[59])
  191. /* for everything that can't use the above */
  192. #define Qxx " pnbrqk"
  193. #define Pxx " PNBRQK"
  194. #define Cxx "abcdefgh"
  195. #define Rxx "12345678"
  196. /***************************************************************************/
  197. /***************** Table limits ********************************************/
  198. #define TREE 1500    /* max number of tree entries */
  199. #define MAXDEPTH 35     /* max depth a search can be carried */
  200. #define MINDEPTH 2      /* min search depth =1 (no hint), >1 hint */
  201. #define MAXMOVES 400    /* max number of half moves in a game */
  202. #define NMOVELIMIT 20
  203. #define XCLIMIT 5    /* number of different Time inputs */
  204. #ifndef BOOKSIZE
  205. #if defined MSDOS
  206. #define BOOKSIZE 10000     /* Number of unique position/move combinations allowed */
  207. #else
  208. #define BOOKSIZE 250000    /* Number of unique position/move combinations allowed */
  209. #endif
  210. #endif
  211. #define CPSIZE 90    /* size of lang file max */
  212. #define DEFETABLE 1001     /* static eval cache */
  213. #ifdef ECO
  214. #define ECOCNT  5
  215. #endif
  216. /***************** tuning paramaters **********************************************/
  217. #define NMOVEINIT { 75,75,60,55,55,55,55,58,55,56,60,64,68,72,76,80,84,88,90,94,98,98,98,98,99,99,99}
  218. #define MINGAMEIN 4
  219. #define MINMOVES 15
  220. #define FBEYOND 5
  221. #define SBEYOND 9
  222. #define TBEYOND 11
  223. #define HASHDEPTH 2     /* depth above which to use HashFile */
  224. #define HASHMOVELIMIT 40   /* Use HashFile only for this many moves */
  225. #define PTVALUE 0         /* material value below which pawn threats at 5 & 3 are used */
  226. #define ZDELTA 40    /* score delta per ply to cause extra time to be given */
  227. #define QBLOCK false    /* if true cache quiescent positions */
  228. #define BESTDELTA 90
  229. /* about 1/2 second worth of nodes for your machine */
  230. #define ZNODES 1000             /* check the time every ZNODES positions */
  231. #define MAXTCCOUNTX  5     /* max number of time clicks per search to complete ply*/
  232. #define MAXTCCOUNTR 6      /* max number of time clicks per search extensions*/
  233. #define HISTORYLIM 4096    /* Max value of history killer */
  234. #define WAWNDW 50    /* alpha window when computer white*/
  235. #define WBWNDW 50    /* beta window when computer white*/
  236. #define BAWNDW 50    /* alpha window when computer black*/
  237. #define BBWNDW 50    /* beta window when computer black*/
  238. #define BXWNDW 50    /* window to force position scoring at lower */
  239. #define WXWNDW 50    /* window to force position scoring at lower */
  240. #ifdef SMALLRANDY
  241. #define DITHER 2     /* max amount random can alter a pos value */
  242. #else
  243. #define DITHER 5
  244. #endif
  245. #define BBONUS 2     /* points per stage value of B increases */
  246. #define RBONUS 6     /* points per stage value of R increases */
  247. #define PCRASHS   5
  248. #define PCRASHV 5
  249. #define PCENTERS 5
  250. #define PCENTERV 5
  251. #define KINGPOSLIMIT  -1   /* King positional scoring limit */
  252. #define KINGSAFETY  40
  253. #define NULLMOVELIM valueQ /* below this total material on board don't use null move */
  254. #define DEPTHMARGIN 2
  255. #define THRSTAGE    6
  256. #define CHECKSTAGE  8
  257.  
  258. /************************* parameters for Opening Book *********************************/
  259. #define BOOKFAIL 8      /* if no book move found for BOOKFAIL turns stop using book */
  260. #define BOOKMAXPLY 12      /* Max plys to keep in book database */
  261. #define BOOKPOCKET 64
  262. #define BOOKRAND 1000      /* used to select an opening move from a list */
  263. #define BOOKENDPCT 950     /* 5 % chance a BOOKEND will stop the book */
  264. #define DONTUSE -32000     /* flag move as don't use */
  265. /*************************** Book access defines ****************************************/
  266. #define LASTMOVE 0x4000    /* means this is the last move of an opening */
  267. #define BADMOVE 0x8000     /* means this is a bad move in this position */
  268. /****************************************************************************************/
  269.  
  270.      struct leaf
  271.      {
  272.          tshort f;
  273.    tshort t;
  274.    tshort  score;
  275.    tshort  reply;
  276.    tshort  width;
  277.          utshort flags;
  278.      };
  279.      struct GameRec
  280.      {
  281.        utshort gmove;   /* this move */
  282.        tshort score;    /* score after this move */
  283.        tshort depth;    /* search depth this move */
  284.        long time;               /* search time this move */
  285.        tshort piece;    /* piece captured */
  286.        tshort color;    /* color */
  287.        tshort flags;    /* move flags capture, promote, castle */
  288.        tshort Game50;      /* flag for repetition */
  289.        long nodes;      /* nodes searched for this move */
  290.        unsigned long hashkey, hashbd;  /* board key before this move */
  291.        tshort epssq;    /* epssquare before this move */
  292. #ifdef DEBUG40
  293.        UTSHORT d1[7];
  294. #endif
  295.      };
  296.      struct TimeControlRec
  297.      {
  298.        SHORT moves[2];
  299.        long clock[2];
  300.      };
  301.  
  302.      struct flags
  303.      {
  304.        SHORT mate;      /* the game is over */
  305.        SHORT post;      /* show principle variation */
  306.        SHORT quit;      /* quit/exit */
  307.        SHORT regularstart; /* did the game start from standard
  308.              * initial board ? */
  309.        SHORT reverse;      /* reverse board display */
  310.        SHORT bothsides;    /* computer plays both sides */
  311.        SHORT hash;      /* enable/disable transposition table */
  312.        SHORT force;     /* enter moves */
  313.        SHORT easy;      /* disable thinking on opponents time */
  314.        SHORT beep;      /* enable/disable beep */
  315.        SHORT timeout;      /* time to make a move */
  316.        SHORT musttimeout;  /* time to make a move */
  317.        SHORT back;      /* time to make a move */
  318.        SHORT rcptr;     /* enable/disable recapture heuristics */
  319.        SHORT coords;    /* add coords to visual screen */
  320.        SHORT material;     /* draw on lack of material */
  321.        SHORT illegal;      /* illegal position */
  322.        SHORT onemove;      /* timing is onemove */
  323.        SHORT gamein;    /* timing is gamein */
  324.        SHORT autolist;     /* list games */
  325.        SHORT threat;            /* Enable threats, tom@izf.tno.nl */
  326.        SHORT nonull;            /* Disable nullmoves, tom@izf.tno.nl */
  327.        SHORT deepnull;          /* Enable deep nullmoves, tom@izf.tno.nl */
  328.        SHORT verydeep;          /* Enable very deep nullmoves, tom@izf.tno.nl */
  329.        SHORT pvs;               /* Enable PVS, tom@izf.tno.nl */
  330.        SHORT neweval;           /* Enable new eval, tom@izf.tno.nl */
  331.        SHORT noscore;           /* Enable no score heuristic, tom@izf.tno.nl */
  332.        SHORT abort;
  333.        SHORT animate;
  334.        SHORT usebook;
  335.        SHORT searching;
  336.        SHORT editing;
  337.        SHORT replay;
  338. #ifdef DEBUG
  339.    SHORT nott;
  340.    SHORT noft;
  341.    SHORT nocache;
  342. #endif
  343.      };
  344.  
  345. extern struct bitmaps
  346.  {
  347.    HBITMAP detail;
  348.    HBITMAP mask;
  349.  } pieces[7];
  350.  
  351. #ifdef DEBUG
  352.      extern FILE *debugfile;
  353.  
  354. #endif /* DEBUG */
  355. #ifdef HISTORY
  356.      extern UTSHORT history[32768];
  357. #endif
  358.      extern CHAR *ColorStr[2];
  359.      extern UTSHORT MV[MAXDEPTH+1];
  360.      extern SHORT PCRASH,PCENTER;
  361.      extern int MSCORE;
  362.      extern int mycnt1, mycnt2;
  363.      extern SHORT chesstool;
  364.      extern struct leaf Tree[TREE], *root,rootnode;
  365.      extern CHAR savefile[], listfile[];
  366.      extern SHORT TrPnt[];
  367.      extern SHORT board[], color[];
  368.      extern SHORT PieceList[2][64], PawnCnt[2][8];
  369.      extern SHORT castld[], Mvboard[];
  370.      extern tshort svalue[64];
  371.      extern struct flags flag;
  372.      extern SHORT opponent, computer, INCscore;
  373.      extern tshort WAwindow, BAwindow, WBwindow, BBwindow;
  374.      extern SHORT dither, player;
  375.      extern tshort xwndw, contempt;
  376.      extern SHORT epsquare;
  377.      extern long ResponseTime, ExtraTime, MaxResponseTime, et, et0, time0, ft;
  378.      extern long reminus, replus;
  379.      extern unsigned long GenCnt, NodeCnt, ETnodes, EvalNodes;
  380.      extern tshort HashDepth, HashMoveLimit;
  381.      extern struct GameRec GameList[];
  382.      extern SHORT GameCnt, Game50;
  383.      extern SHORT Sdepth, MaxSearchDepth;
  384.      extern int Book;
  385.      extern struct TimeControlRec TimeControl;
  386.      extern int TCadd;
  387.      extern SHORT TCflag, TCmoves, TCminutes, TCseconds, OperatorTime;
  388.      extern int timecomp[MINGAMEIN], timeopp[MINGAMEIN];
  389.      extern int compptr,oppptr;
  390.      extern SHORT XCmore,XCadd[], XCmoves[], XCminutes[], XCseconds[], XC;
  391.      extern const SHORT otherside[];
  392.      extern const SHORT Stboard[];
  393.      extern const SHORT Stcolor[];
  394.      extern SHORT hint;
  395.      extern SHORT TOflag;
  396.      extern SHORT stage, stage2, Developed[];
  397.      extern SHORT ChkFlag[], CptrFlag[], PawnThreat[];
  398.      extern SHORT QueenCheck[];  /* tom@izf.tno.nl */
  399.      extern SHORT NMoves[];  /* tom@izf.tno.nl */
  400.      extern SHORT Threat[];  /* tom@izf.tno.nl */
  401.      extern SHORT ThreatSave[];  /* tom@izf.tno.nl */
  402.      extern SHORT Pscore[], Tscore[];
  403.      extern SHORT mtl[], pmtl[], hung[], emtl[];
  404.      extern SHORT Pindex[];
  405.      extern SHORT PieceCnt[];
  406.      extern SHORT FROMsquare, TOsquare;
  407.      extern SHORT HasKnight[], HasBishop[], HasRook[], HasQueen[];
  408.      extern const SHORT qrook[];
  409.      extern const SHORT krook[];
  410.      extern const SHORT kingP[];
  411.      extern const SHORT rank7[];
  412.      extern const SHORT sweep[];
  413.      extern const SHORT epmove1[], epmove2[];
  414.      extern UTSHORT killr0[], killr1[];
  415.      extern UTSHORT killr2[], killr3[];
  416.      extern UTSHORT PV, SwagHt, Swag0, Swag1, Swag2, Swag3, Swag4, sidebit;
  417.      extern tshort killt[0x4000];
  418.      extern SHORT mtl[2], pmtl[2], hung[2];
  419.      extern const SHORT value[];
  420.      extern const SHORT control[];
  421.      extern UCHAR nextpos[8][64][64];
  422.      extern UCHAR nextdir[8][64][64];
  423.      extern const SHORT ptype[2][8];
  424.      extern unsigned int starttime;
  425.      extern SHORT distdata[64][64], taxidata[64][64];
  426.      extern CHAR mvstr[5][7];
  427. #ifndef AMIGADOS
  428.      extern union U admin;
  429. #endif
  430.      extern UTSHORT bookmaxply;
  431.      extern unsigned long bookcount;
  432.      extern unsigned long booksize;
  433.      extern CHAR *CP[];
  434. #ifdef QUIETBACKGROUND
  435.      extern SHORT background;
  436. #endif /* QUIETBACKGROUND */
  437.  
  438.      extern CHAR *DRAW;
  439.  
  440.      extern char szAppName[];
  441.      extern SHORT command;
  442.      extern char move[6];
  443.      extern HWND hWnd;
  444.      extern HFONT hFont;
  445.      extern SHORT LineSpace,SLineSpace,CharWidth,CompColorExt,WhoseTurnExt,
  446.             squarebd;
  447.      extern char msg[200];
  448.      extern HWND hComputerColor,hWhoseTurn,hInCheck,hComputerMove,hClockBlack,
  449.          hClockWhite,hBlack,hWhite,hDepth,hStats;
  450.      extern HANDLE hInst;
  451.      extern tshort WXwindow, BXwindow;
  452.  
  453.      extern POINT boardpg[4];
  454.      extern POINT squares[8][8][4];
  455.      extern POINT pieceloc[64];
  456.  
  457.      extern DWORD clrBackGround;
  458.      extern DWORD clrBlackSquare;
  459.      extern DWORD clrWhiteSquare;
  460.      extern DWORD clrBlackPiece;
  461.      extern DWORD clrWhitePiece;
  462.      extern DWORD clrText;
  463.      extern DWORD clrEdge;
  464.  
  465.      extern SHORT sqwidthF;
  466.      extern SHORT sqwidthB;
  467.      extern SHORT sqdepth;
  468.      extern SHORT boardsize;
  469.      extern SHORT deltaX;
  470.      extern SHORT bmsize;
  471.  
  472. #define distance(a,b) distdata[a][b]
  473. #define row(a) ((a) >> 3)
  474. #define column(a) ((a) & 7)
  475. #define locn(a,b) (((a) << 3) | (b))
  476.      extern SHORT distdata[64][64];
  477.  
  478. /* init external functions */
  479.      extern void InitConst (CHAR *lang);
  480.      extern void Initialize_dist (void);
  481.      extern void NewGame (void);
  482.      extern int parse (FILE * fd, UTSHORT *mv, SHORT side, CHAR *opening);
  483.      extern void GetOpenings (void);
  484.      extern int OpeningBook (SHORT *hint, SHORT side);
  485.      extern int GOpeningBook (SHORT *hint, SHORT side, CHAR *mv);
  486.      extern void SelectMove (SHORT side, SHORT iop);
  487.      extern int
  488.       search (SHORT side,
  489.           SHORT ply,
  490.           SHORT depth,
  491.                SHORT ext,
  492.           SHORT alpha,
  493.           SHORT beta,
  494.           UTSHORT *bstline,
  495.           SHORT *rpt,
  496.           SHORT SAVEHT,
  497.           SHORT didnull );
  498.      extern void Initialize_moves (void);
  499.      extern void MoveList (SHORT side, SHORT ply);
  500.      extern void CaptureList (SHORT side, SHORT ply);
  501.      extern int castle (SHORT side, SHORT kf, SHORT kt, SHORT iop);
  502.      extern void ataks (SHORT side, SHORT *a);
  503.      extern void
  504.       MakeMove (SHORT side,
  505.        struct leaf * node,
  506.        SHORT *tempb,
  507.        SHORT *tempc,
  508.        SHORT *tempsf,
  509.        SHORT *tempst);
  510.      extern void
  511.       UnmakeMove (SHORT side,
  512.          struct leaf * node,
  513.          SHORT *tempb,
  514.          SHORT *tempc,
  515.          SHORT *tempsf,
  516.          SHORT *tempst);
  517.      extern void InitializeStats (void);
  518.      extern int
  519.       evaluate (SHORT side,
  520.        SHORT ply,
  521.        SHORT depth,
  522.        SHORT ext,
  523.        SHORT alpha,
  524.        SHORT beta,
  525.             SHORT *terminal,
  526.        SHORT *InChk);
  527.      extern SHORT ScorePosition (SHORT side);
  528.      extern void ExaminePosition (void);
  529.      extern void UpdateWeights (void);
  530.      extern void Initialize (void);
  531.      extern void InputCommand (void);
  532.      extern void SetTimeControl (void);
  533.      extern void SelectLevel (CHAR *sx);
  534.      extern void
  535.       UpdateDisplay (SHORT f,
  536.             SHORT t,
  537.             SHORT flag,
  538.             SHORT iscastle,
  539.             HDC hDc);
  540.      extern void ElapsedTime (SHORT iop);
  541.      extern void ShowSidetoMove (void);
  542.      extern void SearchStartStuff (SHORT side);
  543.      extern void ShowDepth (CHAR ch);
  544.      extern void TerminateSearch (int);
  545.      extern void
  546.       ShowResults (SHORT score,
  547.           UTSHORT *bstline,
  548.           CHAR ch);
  549.      extern void PromptForMove (void);
  550.      extern void SetupBoard (void);
  551.      extern void algbr (SHORT f, SHORT t, SHORT flag);
  552.      extern void OutputMove (SHORT score);
  553.      extern void ShowCurrentMove (SHORT pnt, SHORT f, SHORT t);
  554.      extern void ListGame (void);
  555.      extern void ShowMessage (CHAR *s);
  556.      extern void DrawPiece (SHORT sq,HDC hDC);
  557.      extern void UpdateClocks (void);
  558.      extern void DoDebug (void);
  559.      extern void DoTable (SHORT table[64]);
  560.      extern void ShowPostnValues (void);
  561.      extern void ChangeXwindow (void);
  562.      extern void SetContempt (void);
  563.      extern void ChangeHashDepth (void);
  564.      extern void ChangeBetaWindow (void);
  565.      extern void ChangeAlphaWindow (void);
  566.      extern void GiveHint (void);
  567.      extern void ShowPrompt (void);
  568.      extern void EditBoard (void);
  569.      extern void help (void);
  570.      extern void ChangeSearchDepth (void);
  571.      extern void skip (void);
  572.      extern void skipb (void);
  573.      extern void EnPassant (SHORT xside, SHORT f, SHORT t, SHORT iop);
  574.      extern void ShowNodeCnt (long int NodeCnt);
  575.      extern void ShowLine (UTSHORT *bstline);
  576.      extern int pick (SHORT p1, SHORT p2);
  577.      extern int VerifyMove (CHAR *s, SHORT inp, UTSHORT *mv);
  578.      extern void VMoveList (SHORT side, register SHORT ply);
  579.  
  580.      extern void CheckMessage(void);
  581.      extern void InitScreen(void);
  582.      extern void SetStaticPos(void);
  583.      extern void Exit(int);
  584.  
  585. #if !defined(AMIGADOS)
  586.      extern struct gdxadmin B;
  587. #endif
  588.  
  589. #if defined(AMIGADOS)  &&  !defined(XBOARD)
  590. #define exit(retcode) CleanExit(retcode)
  591. #endif
  592. /* Take care of MEMSET once and for all... */
  593. #if (!defined(HAVE_MEMSET) || defined(MSDOS)) && !defined(__GNUC__)
  594. #define memset(s,c,l) {\
  595.   unsigned long j; \
  596.     for (j = 0; j < (l); j++) \
  597.       ((CHAR *)s)[j] = (c);}
  598. #endif /* MEMSET */
  599.  
  600. #define CBLACK    RGB(0,0,0)
  601. #define BLUE      RGB(0,0,255)
  602. #define GREEN     RGB(0,255,0)
  603. #define CYAN      RGB(128,255,255)
  604. #define RED       RGB(255,0,0)
  605. #define PINK      RGB(255,0,255)
  606. #define YELLOW    RGB(255,255,0)
  607. #define PALEGRAY  RGB(192,192,192)
  608. #define DARKGRAY  RGB(127,127,127)
  609. #define DARKBLUE  RGB(0,0,128)
  610. #define DARKGREEN RGB(0,128,0)
  611. #define DARKCYAN  RGB(0,255,255)
  612. #define DARKRED   RGB(128,0,0)
  613. #define DARKPINK  RGB(255,0,128)
  614. #define BROWN     RGB(128,128,64)
  615. #define CWHITE    RGB(255,255,255)
  616.  
  617. #define SMALL 0
  618. #define MEDIUM 12
  619. #define LARGE 24
  620. #define BRD_EDGE 5
  621. #define LEFTMARGIN  25
  622. #define BACKMARGIN  5
  623.  
  624. #define IDM_NEW         101
  625. #define IDM_GET         102
  626. #define IDM_SAVE        103
  627. #define IDM_LIST        104
  628. #define IDM_QUIT        105
  629.  
  630. #define IDM_EDIT        201
  631. #define IDM_REVIEW      202
  632. #define IDM_UNDO        203
  633. #define IDM_REMOVE      204
  634. #define IDM_FORCE       205
  635.  
  636. #define IDM_BEEP        301
  637. #define IDM_COORD       302
  638. #define IDM_POST        303
  639. #define IDM_TEST        304
  640. #define IDM_BOOK        305
  641. #define IDM_HASH        306
  642. #define IDM_HDEPTH      307
  643. #define IDM_HFILE       308
  644. #define IDM_COMPILE     318
  645. #define IDM_WIN         309
  646. #define IDM_CONTEMP     310
  647. #define IDM_ANIMATE     311
  648. #define IDM_MATERIAL    312
  649. #define IDM_RCPTR       313
  650. #define IDM_THREAT      314
  651. #define IDM_PVS         315
  652. #define IDM_NEWEVAL     316
  653. #define IDM_GAMEIN      317
  654.  
  655. #define IDM_TIME        401
  656. #define IDM_RANDOM      402
  657. #define IDM_EASY        403
  658. #define IDM_DEPTH       404
  659.  
  660. #define IDM_REVERSE     501
  661. #define IDM_SWITCH      502
  662. #define IDM_BLACK       503
  663. #define IDM_WHITE       504
  664. #define IDM_BOTH        505
  665. #define IDM_WTM         506
  666. #define IDM_BTM         507
  667. #define IDM_SWITCHDM    508
  668.  
  669. #define IDM_BACKGROUND  601
  670. #define IDM_BLACKSQUARE 602
  671. #define IDM_WHITESQUARE 603
  672. #define IDM_BLACKPIECE  604
  673. #define IDM_WHITEPIECE  605
  674. #define IDM_TEXT        606
  675. #define IDM_EDGE        607
  676. #define IDM_DEFAULT     608
  677. #define IDM_SMALL       609
  678. #define IDM_MEDIUM      610
  679. #define IDM_LARGE       611
  680. #define IDM_SQUARE      612
  681. #define IDM_3D          613
  682.  
  683. #define IDM_HINT        701
  684.  
  685. #define IDM_INDEX       801
  686. #define IDM_HELP        802
  687. #define IDM_ABOUT       803
  688.  
  689. #define IDM_CLEAR   901
  690. #define IDM_RESTORE 902
  691. #define IDM_DONE    903
  692. #define IDM_PREV    904
  693. #define IDM_NEXT    905
  694.  
  695. #define CHANGEWINDOW 1
  696. #define IDC_WA 101
  697. #define IDC_WB 102
  698. #define IDC_WX 103
  699. #define IDC_BA 104
  700. #define IDC_BB 105
  701. #define IDC_BX 106
  702. #define IDC_APROMPT 201
  703. #define IDC_BPROMPT 202
  704. #define IDC_XPROMPT 203
  705. #define IDC_WHITE   204
  706. #define IDC_BLACK   205
  707.  
  708. #define NUMDLG 2
  709. #define IDC_NUM   101
  710. #define IDC_PROMPT 201
  711.  
  712. #define ABOUT  3
  713.  
  714. #define TIME   4
  715. #define IDC_MOVES1 101
  716. #define IDC_MOVES2 102
  717. #define IDC_MOVES3 103
  718. #define IDC_MINS1  104
  719. #define IDC_MINS2  105
  720. #define IDC_MINS3  106
  721. #define IDC_MAXRT  107
  722. #define IDC_MRTEXT 108
  723. #define IDC_MRSECS 109
  724.  
  725. #define STATS  5
  726. #define IDC_POS 101
  727. #define IDC_SCORE 102
  728. #define IDC_NODE 103
  729. #define IDC_NODESEC 104
  730. #define IDC_TREE 105
  731. #define IDC_BESTLINE 106
  732.  
  733. #define HASHDEPTHDLG 6
  734. #define IDC_DEPTH 101
  735. #define IDC_MOVELIM 102
  736. #define IDC_DPROMPT 201
  737. #define IDC_MLPROMPT 202
  738.  
  739. #define PROMOTE 7
  740. #define IDC_N 101
  741. #define IDC_B 102
  742. #define IDC_R 103
  743. #define IDC_Q 104
  744.  
  745. #define CREATEHASH 8
  746. #define IDC_HFSIZE 101
  747.  
  748. #define COMPILEBOOK  9
  749. #define IDC_OFFSET 101
  750. #define IDC_REC   102
  751. #define IDC_GAMES 103
  752.  
  753.