home *** CD-ROM | disk | FTP | other *** search
/ MORE WinGames / WINGAMES.iso / chess / globals.c < prev    next >
C/C++ Source or Header  |  1991-06-16  |  4KB  |  147 lines

  1. /*
  2.   C source for GNU CHESS
  3.  
  4.   Revision: 1990-09-30
  5.  
  6.   Modified by Daryl Baker for use in MS WINDOWS environment
  7.  
  8.   Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
  9.   Copyright (c) 1988, 1989, 1990  John Stanback
  10.  
  11.   This file is part of CHESS.
  12.  
  13.   CHESS is distributed in the hope that it will be useful, but WITHOUT ANY
  14.   WARRANTY.  No author or distributor accepts responsibility to anyone for
  15.   the consequences of using it or for whether it serves any particular
  16.   purpose or works at all, unless he says so in writing.  Refer to the CHESS
  17.   General Public License for full details.
  18.  
  19.   Everyone is granted permission to copy, modify and redistribute CHESS, but
  20.   only under the conditions described in the CHESS General Public License.
  21.   A copy of this license is supposed to have been given to you along with
  22.   CHESS so you can know your rights and responsibilities.  It should be in a
  23.   file named COPYING.  Among other things, the copyright notice and this
  24.   notice must be preserved on all copies.
  25. */
  26.  
  27. #define NOATOM 
  28. #define NOCLIPBOARD
  29. #define NOCREATESTRUCT
  30. #define NOFONT
  31. #define NOREGION
  32. #define NOSOUND
  33. #define NOWH
  34. #define NOWINOFFSETS
  35. #define NOCOMM
  36. #define NOKANJI
  37.  
  38. #include <windows.h>
  39. #include <stdio.h>
  40.  
  41. #include "gnuchess.h"
  42.  
  43. struct BookEntry far  *Book;
  44.  
  45. #if ttblsz
  46. unsigned long hashkey, hashbd;
  47. /*struct hashval hashcode[2][7][64];*/
  48. /*static struct huge ttable[2][ttblsz]; */
  49. struct hashval far *hashcode;
  50. struct hashentry far *ttable;
  51. #endif /* ttblsz */
  52.  
  53. FILE *hashfile;
  54. /*struct leaf Tree[2000], *root;*/
  55. struct leaf far *Tree, far *root;
  56.  
  57. short TrPnt[maxdepth];
  58. short PieceList[2][16], PawnCnt[2][8];
  59. #define wking PieceList[white][0]
  60. #define bking PieceList[black][0]
  61. #define EnemyKing PieceList[c2][0]
  62. short castld[2], Mvboard[64];
  63. short svalue[64];
  64. struct flags flag;
  65. short opponent, computer, Awindow, Bwindow, dither, INCscore;
  66. long ResponseTime, ExtraTime, Level, et, et0, time0, ft;
  67. long NodeCnt, ETnodes, EvalNodes, HashCnt, FHashCnt, HashCol;
  68. short player, xwndw, rehash;
  69.  
  70. /*struct GameRec GameList[512];*/
  71. struct GameRec far *GameList;
  72.  
  73. short Sdepth, GameCnt, Game50, MaxSearchDepth;
  74. short epsquare, contempt;
  75. /*struct BookEntry *Book;*/
  76. struct TimeControlRec TimeControl;
  77. short TCflag, TCmoves, TCminutes, OperatorTime;
  78. unsigned short hint, PrVar[maxdepth];
  79. short Pindex[64];
  80. short PieceCnt[2];
  81. short c1, c2, *atk1, *atk2, *PC1, *PC2, atak[2][64];
  82. short mtl[2], pmtl[2], emtl[2], hung[2];
  83. short FROMsquare, TOsquare, Zscore, zwndw;
  84. short HasKnight[2], HasBishop[2], HasRook[2], HasQueen[2];
  85. short ChkFlag[maxdepth], CptrFlag[maxdepth], PawnThreat[maxdepth];
  86. short Pscore[maxdepth], Tscore[maxdepth];
  87. unsigned short killr0[maxdepth], killr1[maxdepth];
  88. unsigned short killr2[maxdepth], killr3[maxdepth];
  89. unsigned short PV, Swag0, Swag1, Swag2, Swag3, Swag4;
  90. /*unsigned char history[8192];*/
  91. unsigned char far *history;
  92.  
  93. short rpthash[2][256];
  94. short Mwpawn[64], Mbpawn[64], Mknight[2][64], Mbishop[2][64];
  95. short Mking[2][64], Kfield[2][64];
  96. short KNIGHTPOST, KNIGHTSTRONG, BISHOPSTRONG, KATAK;
  97. short PEDRNK2B, PWEAKH, PADVNCM, PADVNCI, PAWNSHIELD, PDOUBLED, PBLOK;
  98. short RHOPN, RHOPNX, KHOPN, KHOPNX, KSFTY;
  99. short ATAKD, HUNGP, HUNGX, KCASTLD, KMOVD, XRAY, PINVAL;
  100. short stage, stage2, Developed[2];
  101. short PawnBonus, BishopBonus, RookBonus;
  102.  
  103. /*short distdata[64][64], taxidata[64][64];*/
  104. short far *distdata, far *taxidata;
  105.  
  106. short board[64], color[64];
  107. /*unsigned char nextpos[8][64][64]; */
  108. /*unsigned char nextdir[8][64][64]; */
  109. unsigned char far *nextpos;
  110. unsigned char far *nextdir;
  111.  
  112.  
  113. const short otherside[3] = {1, 0, 2};
  114.  
  115. #if ttblsz
  116. #if HASHFILE
  117. /*
  118.   In a networked enviroment gnuchess might be compiled on different
  119.   hosts with different random number generators, that is not acceptable
  120.   if they are going to share the same transposition table.
  121. */
  122. static unsigned long int next = 1;
  123.  
  124. unsigned int urand (void)
  125. {
  126.   next *= 1103515245;
  127.   next += 12345;
  128.   return ((unsigned int) (next >> 16) & 0xFFFF);
  129. }
  130.  
  131. void srand (unsigned int seed)
  132. {
  133.   next = seed;
  134. }
  135. #endif /*HASHFILE*/
  136. #endif /*ttblsz*/
  137.  
  138. HWND hComputerColor;
  139. HWND hComputerMove;
  140. HWND hWhosTurn;
  141. HWND hClockComputer;
  142. HWND hClockHuman;
  143. HWND hMsgComputer;
  144. HWND hMsgHuman;
  145. HWND hStats;
  146.  
  147.