2 * globals.c - C source for GNU SHOGI
4 * Copyright (c) 1993, 1994, 1995 Matthias Mutz
6 * GNU SHOGI is based on GNU CHESS
8 * Copyright (c) 1988,1989,1990 John Stanback
9 * Copyright (c) 1992 Free Software Foundation
11 * This file is part of GNU SHOGI.
13 * GNU Shogi is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 1, or (at your option)
18 * GNU Shogi is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GNU Shogi; see the file COPYING. If not, write to
25 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
31 short int ahead = true, hash = true;
33 char far *Lang = NULL;
36 short FROMsquare, TOsquare;
38 small_short ChkFlag[MAXDEPTH], CptrFlag[MAXDEPTH], TesujiFlag[MAXDEPTH];
39 short Pscore[MAXDEPTH], Tscore[MAXDEPTH];
40 small_short Pindex[NO_SQUARES];
42 short mtl[2], hung[2];
43 small_short PieceCnt[2];
52 extern char *binbookfile;
54 extern char *bookfile;
56 unsigned long hashkey, hashbd;
61 short rpthash[2][256];
62 short TrPnt[MAXDEPTH];
63 small_short PieceList[2][NO_SQUARES];
64 small_short PawnCnt[2][NO_COLS];
65 small_short Captured[2][NO_PIECES];
66 small_short Mvboard[NO_SQUARES];
67 #if !defined SAVE_SVALUE
68 short svalue[NO_SQUARES];
72 short opponent, computer, WAwindow, WBwindow, BAwindow, BBwindow, dither,
74 long ResponseTime=0, ExtraTime=0, MaxResponseTime=0, et=0, et0=0, time0=0, ft=0;
78 long GenCnt, NodeCnt, ETnodes, EvalNodes, HashCnt, HashAdd, FHashCnt, FHashAdd,
79 HashCol, THashCol, filesz, hashmask, hashbase;
81 short HashDepth = HASHDEPTH, HashMoveLimit = HASHMOVELIMIT;
84 short Sdepth, Game50, MaxSearchDepth;
88 struct TimeControlRec TimeControl;
90 short TCflag, TCmoves, TCminutes, TCseconds, OperatorTime;
91 short XCmoves[3]={0,0,0};
92 short XCminutes[3]={0,0,0};
93 short XCseconds[3]={0,0,0};
95 const short otherside[3] =
96 {white, black, neutral};
98 short int TOflag; /* force search re-init if we backup search */
100 unsigned short killr0[MAXDEPTH], killr1[MAXDEPTH];
101 unsigned short killr2[MAXDEPTH], killr3[MAXDEPTH];
102 unsigned short PV, SwagHt, Swag0, Swag1, Swag2, Swag3, Swag4, sidebit;
104 small_short HasPiece[2][NO_PIECES];
106 const short kingP[3] =
109 const small_short relative_value[NO_PIECES] =
110 {0, 1, 3, 4, 7, 9, 10, 12,
111 2, 5, 6, 8, 11, 13, 14};
113 const long control[NO_PIECES] =
114 {0, ctlP, ctlL, ctlN, ctlS, ctlG, ctlB, ctlR,
115 ctlPp, ctlLp, ctlNp, ctlSp, ctlBp, ctlRp, ctlK };
124 unsigned int starttime;
126 int timeopp[MINGAMEIN], timecomp[MINGAMEIN];
130 struct leaf far *Tree = NULL;
132 hashcode_array far *hashcode = NULL;
133 drop_hashcode_array far *drop_hashcode = NULL;
135 struct leaf far *root = NULL;
137 struct GameRec far *GameList = NULL;
139 value_array far *value = NULL;
140 fscore_array far *fscore = NULL;
142 #ifndef SAVE_DISTDATA
143 short use_distdata = true;
144 distdata_array far *distdata = NULL;
147 #ifndef SAVE_PTYPE_DISTDATA
148 short use_ptype_distdata = true;
149 distdata_array far *ptype_distdata[NO_PTYPE_PIECES];
152 #if !defined SAVE_NEXTPOS
153 next_array far *nextdir[NO_PTYPE_PIECES];
154 next_array far *nextpos[NO_PTYPE_PIECES];
155 short use_nextpos = true;
159 short use_history = true;
160 unsigned short far *history = NULL;
164 short use_etable = true;
165 etable_field far *etab[2] = {NULL,NULL};
169 short use_ttable = true;
170 unsigned int ttblsize = ttblsz;
171 struct hashentry far *ttable[2] = {NULL,NULL};