File: globals.c

package info (click to toggle)
gnushogi 1.5~git20140725-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 1,900 kB
  • sloc: ansic: 12,731; sh: 4,104; makefile: 128
file content (203 lines) | stat: -rw-r--r-- 4,739 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*
 * FILE: globals.c
 *
 * ----------------------------------------------------------------------
 * Copyright (c) 1993, 1994, 1995 Matthias Mutz
 * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
 * Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation
 *
 * GNU SHOGI is based on GNU CHESS
 *
 * Copyright (c) 1988, 1989, 1990 John Stanback
 * Copyright (c) 1992 Free Software Foundation
 *
 * This file is part of GNU SHOGI.
 *
 * GNU Shogi is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 3 of the License,
 * or (at your option) any later version.
 *
 * GNU Shogi is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with GNU Shogi; see the file COPYING. If not, see
 * <http://www.gnu.org/licenses/>.
 * ----------------------------------------------------------------------
 *
 */

#include "gnushogi.h"


short ahead = true, hash = true;
char  *xwin = 0;
char  *Lang = NULL;


short FROMsquare, TOsquare;

small_short ChkFlag[MAXDEPTH], CptrFlag[MAXDEPTH], TesujiFlag[MAXDEPTH];
short Pscore[MAXDEPTH], Tscore[MAXDEPTH];
small_short Pindex[NO_SQUARES];

short mtl[2], hung[2];
small_short PieceCnt[2];

char ColorStr[2][10];

long znodes;



#ifdef BINBOOK
extern char *binbookfile;
#endif

extern char *bookfile;

unsigned long hashkey, hashbd;

char savefile[128];
char listfile[128];

short rpthash[2][256];
short TrPnt[MAXDEPTH];
small_short PieceList[2][NO_SQUARES];
small_short PawnCnt[2][NO_COLS];
small_short Captured[2][NO_PIECES];
small_short Mvboard[NO_SQUARES];

#if !defined SAVE_SVALUE
short svalue[NO_SQUARES];
#endif

struct flags flag;

short opponent, computer, WAwindow, WBwindow, BAwindow, BBwindow, dither,
    INCscore = 0;
long ResponseTime = 0, ExtraTime = 0, MaxResponseTime = 0,
    et = 0, et0 = 0, time0 = 0, ft = 0;

#ifdef INTERRUPT_TEST
long it, itime0;
#endif

long  GenCnt, NodeCnt, ETnodes, EvalNodes, HashCnt, HashAdd,
    FHashCnt, FHashAdd, HashCol, THashCol, filesz, hashmask, hashbase;
long  replus, reminus;
short HashDepth = HASHDEPTH, HashMoveLimit = HASHMOVELIMIT;
short player, xwndw;
short rehash = -1;
short Sdepth, Game50, MaxSearchDepth;
short GameCnt = 0;
short contempt;
int   Book;
struct TimeControlRec TimeControl;
int   TCadd = 0;
short TCflag, TCmoves, TCminutes, TCseconds, OperatorTime;
short XCmoves[3]   = { 0, 0, 0 };
short XCminutes[3] = { 0, 0, 0 };
short XCseconds[3] = { 0, 0, 0 };
short XC = 0, XCmore = 0;
const short otherside[3] = { white, black, neutral };
unsigned short hint;
short TOflag;       /* force search re-init if we backup search */

unsigned short killr0[MAXDEPTH], killr1[MAXDEPTH];
unsigned short killr2[MAXDEPTH], killr3[MAXDEPTH];
unsigned short PV, SwagHt, Swag0, Swag1, Swag2, Swag3, Swag4, sidebit;

small_short HasPiece[2][NO_PIECES];

const short kingP[3] =
{ 4, 76, 0 };

const small_short relative_value[NO_PIECES] =
{ 0,  1,
#ifndef MINISHOGI
  3,  4,
#endif
  7,  9,  10,  12,
  2,
#ifndef MINISHOGI
  5,  6,
#endif
8, 11, 13,  14 };

const long control[NO_PIECES] =
{ 0,  ctlP,
#ifndef MINISHOGI
  ctlL,  ctlN,
#endif
  ctlS,  ctlG, ctlB, ctlR,
  ctlPp,
#ifndef MINISHOGI
  ctlLp, ctlNp,
#endif
  ctlSp, ctlBp, ctlRp, ctlK };

short stage, stage2;
short balance[2];

#ifdef HASHFILE
FILE *hashfile;
#endif

unsigned int starttime;

int timeopp[MINGAMEIN], timecomp[MINGAMEIN];
int compptr, oppptr;


struct leaf  *Tree = NULL;

hashcode_array       *hashcode      = NULL;
drop_hashcode_array  *drop_hashcode = NULL;

struct leaf  *root = NULL;

struct GameRec  *GameList = NULL;

value_array   *value  = NULL;
fscore_array  *fscore = NULL;

#ifndef SAVE_DISTDATA
short use_distdata = true;
distdata_array  *distdata = NULL;
#endif

#ifndef SAVE_PTYPE_DISTDATA
short use_ptype_distdata = true;
distdata_array  *ptype_distdata[NO_PTYPE_PIECES];
#endif

#if !defined SAVE_NEXTPOS
next_array  *nextdir[NO_PTYPE_PIECES];
next_array  *nextpos[NO_PTYPE_PIECES];
short use_nextpos = true;
#endif

#if defined HISTORY
short use_history = true;
unsigned short  *history = NULL;
#endif

#ifdef CACHE
short use_etable = true;
etable_field  *etab[2] = { NULL, NULL };
#endif

#if ttblsz
short use_ttable = true;
unsigned int ttblsize = ttblsz;
struct hashentry  *ttable[2] = { NULL, NULL };
#endif

char *DRAW;
char *DRAW_REPETITION = "Repetition";
char *DRAW_MAXMOVES = "Max Moves";
char *DRAW_JUSTDRAW = "Drawn game!";