4 * ----------------------------------------------------------------------
6 * Copyright (c) 2012 Free Software Foundation
8 * GNU SHOGI is based on GNU CHESS
10 * This file is part of GNU SHOGI.
12 * GNU Shogi is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 3 of the License,
15 * or (at your option) any later version.
17 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * You should have received a copy of the GNU General Public License along
23 * with GNU Shogi; see the file COPYING. If not, see
24 * <http://www.gnu.org/licenses/>.
25 * ----------------------------------------------------------------------
32 short ahead = true, hash = true;
37 short FROMsquare, TOsquare;
39 small_short ChkFlag[MAXDEPTH], CptrFlag[MAXDEPTH], TesujiFlag[MAXDEPTH];
40 short Pscore[MAXDEPTH], Tscore[MAXDEPTH];
41 small_short Pindex[NO_SQUARES];
43 short mtl[2], hung[2];
44 small_short PieceCnt[2];
53 extern char *binbookfile;
56 extern char *bookfile;
58 unsigned long hashkey, hashbd;
63 short rpthash[2][256];
64 short TrPnt[MAXDEPTH];
65 small_short PieceList[2][NO_SQUARES];
66 small_short PawnCnt[2][NO_COLS];
67 small_short Captured[2][NO_PIECES];
68 small_short Mvboard[NO_SQUARES];
70 #if !defined SAVE_SVALUE
71 short svalue[NO_SQUARES];
76 short opponent, computer, WAwindow, WBwindow, BAwindow, BBwindow, dither,
78 long ResponseTime = 0, ExtraTime = 0, MaxResponseTime = 0,
79 et = 0, et0 = 0, time0 = 0, ft = 0;
85 long GenCnt, NodeCnt, ETnodes, EvalNodes, HashCnt, HashAdd,
86 FHashCnt, FHashAdd, HashCol, THashCol, filesz, hashmask, hashbase;
88 short HashDepth = HASHDEPTH, HashMoveLimit = HASHMOVELIMIT;
91 short Sdepth, Game50, MaxSearchDepth;
95 struct TimeControlRec TimeControl;
97 short TCflag, TCmoves, TCminutes, TCseconds, OperatorTime;
98 short XCmoves[3] = { 0, 0, 0 };
99 short XCminutes[3] = { 0, 0, 0 };
100 short XCseconds[3] = { 0, 0, 0 };
101 short XC = 0, XCmore = 0;
102 const short otherside[3] = { white, black, neutral };
104 short TOflag; /* force search re-init if we backup search */
106 unsigned short killr0[MAXDEPTH], killr1[MAXDEPTH];
107 unsigned short killr2[MAXDEPTH], killr3[MAXDEPTH];
108 unsigned short PV, SwagHt, Swag0, Swag1, Swag2, Swag3, Swag4, sidebit;
110 small_short HasPiece[2][NO_PIECES];
112 const short kingP[3] =
115 const small_short relative_value[NO_PIECES] =
116 { 0, 1, 3, 4, 7, 9, 10, 12,
117 2, 5, 6, 8, 11, 13, 14 };
119 const long control[NO_PIECES] =
120 { 0, ctlP, ctlL, ctlN, ctlS, ctlG, ctlB, ctlR,
121 ctlPp, ctlLp, ctlNp, ctlSp, ctlBp, ctlRp, ctlK };
130 unsigned int starttime;
132 int timeopp[MINGAMEIN], timecomp[MINGAMEIN];
136 struct leaf *Tree = NULL;
138 hashcode_array *hashcode = NULL;
139 drop_hashcode_array *drop_hashcode = NULL;
141 struct leaf *root = NULL;
143 struct GameRec *GameList = NULL;
145 value_array *value = NULL;
146 fscore_array *fscore = NULL;
148 #ifndef SAVE_DISTDATA
149 short use_distdata = true;
150 distdata_array *distdata = NULL;
153 #ifndef SAVE_PTYPE_DISTDATA
154 short use_ptype_distdata = true;
155 distdata_array *ptype_distdata[NO_PTYPE_PIECES];
158 #if !defined SAVE_NEXTPOS
159 next_array *nextdir[NO_PTYPE_PIECES];
160 next_array *nextpos[NO_PTYPE_PIECES];
161 short use_nextpos = true;
165 short use_history = true;
166 unsigned short *history = NULL;
170 short use_etable = true;
171 etable_field *etab[2] = { NULL, NULL };
175 short use_ttable = true;
176 unsigned int ttblsize = ttblsz;
177 struct hashentry *ttable[2] = { NULL, NULL };