home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 7 Games / 07-Games.zip / PMCHESSR.ZIP / GLOBALS.C < prev    next >
C/C++ Source or Header  |  1990-11-29  |  4KB  |  141 lines

  1. //
  2. //  Copyright (C) 1986, 1987, 1988, 1989, 1990 Free Software Foundation, Inc.
  3. //  Copyright (c) 1988, 1989, 1990  John Stanback
  4. //
  5. //  Project:    OS/2 PM Port of GNU CHESS 3.1 (PmChess)
  6. //
  7. //  Version:    1990-11-17
  8. //
  9. //   Module:    Main Module (PmChess.c)
  10. //
  11. //   Porter:    Ported to Windows 3.0 by Darly Baker
  12. //
  13. //   Porter:    Ported to OS/2 1.2+ by Kent Cedola
  14. //
  15. //   System:    OS2 1.2 using Microsoft C 6.0
  16. //
  17. //  Remarks:    This code converted to OS/2 almost as is.  Mostly minor changes
  18. //              to remove Windows code not required under OS/2.
  19. //
  20. //  License:
  21. //
  22. //    CHESS is distributed in the hope that it will be useful, but WITHOUT ANY
  23. //    WARRANTY.  No author or distributor accepts responsibility to anyone for
  24. //    the consequences of using it or for whether it serves any particular
  25. //    purpose or works at all, unless he says so in writing.  Refer to the
  26. //    CHESS General Public License for full details.
  27. //
  28. //    Everyone is granted permission to copy, modify and redistribute CHESS,
  29. //    but only under the conditions described in the CHESS General Public
  30. //    License.  A copy of this license is supposed to have been given to you
  31. //    along with CHESS so you can know your rights and responsibilities.  It
  32. //    should be in a file named COPYING.  Among other things, the copyright
  33. //    notice and this notice must be preserved on all copies.
  34. //
  35.  
  36. #define INCL_DOS
  37. #include <os2.h>
  38. #include <stdio.h>
  39. #include "GnuChess.h"
  40.  
  41.  
  42. #if ttblsz
  43. unsigned long hashkey, hashbd;
  44. struct hashval far hashcode[2][7][64];
  45.  
  46. #ifdef M_I386
  47. struct hashentry ttable[2][ttblsz];
  48. #else
  49. struct hashentry far ttable[2][ttblsz];
  50. #endif
  51.  
  52. #endif /* ttblsz */
  53.  
  54. FILE *hashfile;
  55. struct leaf far Tree[2000], 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 far GameList[512];
  71.  
  72. short Sdepth, GameCnt, Game50, MaxSearchDepth;
  73. short epsquare, contempt;
  74. struct BookEntry *Book;
  75. struct TimeControlRec TimeControl;
  76. short TCflag, TCmoves, TCminutes, OperatorTime;
  77. unsigned short hint, PrVar[maxdepth];
  78. short Pindex[64];
  79. short PieceCnt[2];
  80. short c1, c2, *atk1, *atk2, *PC1, *PC2, atak[2][64];
  81. short mtl[2], pmtl[2], emtl[2], hung[2];
  82. short FROMsquare, TOsquare, Zscore, zwndw;
  83. short HasKnight[2], HasBishop[2], HasRook[2], HasQueen[2];
  84. short ChkFlag[maxdepth], CptrFlag[maxdepth], PawnThreat[maxdepth];
  85. short Pscore[maxdepth], Tscore[maxdepth];
  86. unsigned short killr0[maxdepth], killr1[maxdepth];
  87. unsigned short killr2[maxdepth], killr3[maxdepth];
  88. unsigned short PV, Swag0, Swag1, Swag2, Swag3, Swag4;
  89. unsigned char far history[8192];
  90.  
  91. short rpthash[2][256];
  92. short Mwpawn[64], Mbpawn[64], Mknight[2][64], Mbishop[2][64];
  93. short Mking[2][64], Kfield[2][64];
  94. short KNIGHTPOST, KNIGHTSTRONG, BISHOPSTRONG, KATAK;
  95. short PEDRNK2B, PWEAKH, PADVNCM, PADVNCI, PAWNSHIELD, PDOUBLED, PBLOK;
  96. short RHOPN, RHOPNX, KHOPN, KHOPNX, KSFTY;
  97. short ATAKD, HUNGP, HUNGX, KCASTLD, KMOVD, XRAY, PINVAL;
  98. short stage, stage2, Developed[2];
  99. short PawnBonus, BishopBonus, RookBonus;
  100.  
  101. short far distdata[64][64], far taxidata[64][64];
  102.  
  103. short board[64], color[64];
  104. unsigned char far nextpos[8][64][64];
  105. unsigned char far nextdir[8][64][64];
  106.  
  107.  
  108. short otherside[3] = {1, 0, 2};
  109.  
  110. #if ttblsz
  111. #if HASHFILE
  112. /*
  113.   In a networked enviroment gnuchess might be compiled on different
  114.   hosts with different random number generators, that is not acceptable
  115.   if they are going to share the same transposition table.
  116. */
  117. static unsigned long int next = 1;
  118.  
  119. unsigned int urand (void)
  120. {
  121.   next *= 1103515245;
  122.   next += 12345;
  123.   return ((unsigned int) (next >> 16) & 0xFFFF);
  124. }
  125.  
  126. void srand (unsigned int seed)
  127. {
  128.   next = seed;
  129. }
  130. #endif /*HASHFILE*/
  131. #endif /*ttblsz*/
  132.  
  133. HWND hComputerColor;
  134. HWND hComputerMove;
  135. HWND hWhosTurn;
  136. HWND hClockComputer;
  137. HWND hClockHuman;
  138. HWND hMsgComputer;
  139. HWND hMsgHuman;
  140. HWND hStats;
  141.