6 uint64_t ehash_tbl[ EHASH_MASK + 1 ];
7 trans_table_t *ptrans_table_orig;
8 SHARE trans_table_t *ptrans_table;
9 record_t record_problems;
11 rand_work_t rand_work;
12 root_move_t root_move_list[ MAX_LEGAL_MOVES ];
14 pv_t alast_pv_save[NUM_UNMAKE];
15 slide_tbl_t aslide[ nsquare ];
16 bitboard_t abb_b_knight_attacks[ nsquare ];
17 bitboard_t abb_b_silver_attacks[ nsquare ];
18 bitboard_t abb_b_gold_attacks[ nsquare ];
19 bitboard_t abb_w_knight_attacks[ nsquare ];
20 bitboard_t abb_w_silver_attacks[ nsquare ];
21 bitboard_t abb_w_gold_attacks[ nsquare ];
22 bitboard_t abb_king_attacks[ nsquare ];
23 bitboard_t abb_bishop_attacks_rl45[ nsquare ][ 128 ];
24 bitboard_t abb_bishop_attacks_rr45[ nsquare ][ 128 ];
25 bitboard_t abb_rank_attacks[ nsquare ][ 128 ];
26 bitboard_t abb_file_attacks[ nsquare ][ 128 ];
27 bitboard_t abb_obstacle[ nsquare ][ nsquare ];
28 bitboard_t abb_mask[ nsquare ];
29 bitboard_t abb_mask_rl90[ nsquare ];
30 bitboard_t abb_mask_rl45[ nsquare ];
31 bitboard_t abb_mask_rr45[ nsquare ];
32 bitboard_t abb_plus_rays[ nsquare ];
33 bitboard_t abb_minus_rays[ nsquare ];
34 uint64_t b_pawn_rand[ nsquare ];
35 uint64_t b_lance_rand[ nsquare ];
36 uint64_t b_knight_rand[ nsquare ];
37 uint64_t b_silver_rand[ nsquare ];
38 uint64_t b_gold_rand[ nsquare ];
39 uint64_t b_bishop_rand[ nsquare ];
40 uint64_t b_rook_rand[ nsquare ];
41 uint64_t b_king_rand[ nsquare ];
42 uint64_t b_pro_pawn_rand[ nsquare ];
43 uint64_t b_pro_lance_rand[ nsquare ];
44 uint64_t b_pro_knight_rand[ nsquare ];
45 uint64_t b_pro_silver_rand[ nsquare ];
46 uint64_t b_horse_rand[ nsquare ];
47 uint64_t b_dragon_rand[ nsquare ];
48 uint64_t b_hand_pawn_rand[ npawn_max ];
49 uint64_t b_hand_lance_rand[ nlance_max ];
50 uint64_t b_hand_knight_rand[ nknight_max ];
51 uint64_t b_hand_silver_rand[ nsilver_max ];
52 uint64_t b_hand_gold_rand[ ngold_max ];
53 uint64_t b_hand_bishop_rand[ nbishop_max ];
54 uint64_t b_hand_rook_rand[ nrook_max ];
55 uint64_t w_pawn_rand[ nsquare ];
56 uint64_t w_lance_rand[ nsquare ];
57 uint64_t w_knight_rand[ nsquare ];
58 uint64_t w_silver_rand[ nsquare ];
59 uint64_t w_gold_rand[ nsquare ];
60 uint64_t w_bishop_rand[ nsquare ];
61 uint64_t w_rook_rand[ nsquare ];
62 uint64_t w_king_rand[ nsquare ];
63 uint64_t w_pro_pawn_rand[ nsquare ];
64 uint64_t w_pro_lance_rand[ nsquare ];
65 uint64_t w_pro_knight_rand[ nsquare ];
66 uint64_t w_pro_silver_rand[ nsquare ];
67 uint64_t w_horse_rand[ nsquare ];
68 uint64_t w_dragon_rand[ nsquare ];
69 uint64_t w_hand_pawn_rand[ npawn_max ];
70 uint64_t w_hand_lance_rand[ nlance_max ];
71 uint64_t w_hand_knight_rand[ nknight_max ];
72 uint64_t w_hand_silver_rand[ nsilver_max ];
73 uint64_t w_hand_gold_rand[ ngold_max ];
74 uint64_t w_hand_bishop_rand[ nbishop_max ];
75 uint64_t w_hand_rook_rand[ nrook_max ];
77 SHARE unsigned int game_status;
78 unsigned int amove_save[NUM_UNMAKE];
79 unsigned int move_evasion_pchk;
80 unsigned int node_per_second;
81 unsigned int node_next_signal;
82 unsigned int node_last_check;
83 unsigned int hash_mask;
84 unsigned int sec_elapsed;
85 unsigned int sec_b_total;
86 unsigned int sec_w_total;
87 unsigned int sec_limit;
88 unsigned int sec_limit_up;
89 unsigned int sec_limit_depth;
90 unsigned int time_last_result;
91 unsigned int time_last_check;
92 unsigned int time_start;
93 unsigned int time_turn_start;
94 unsigned int time_limit;
95 unsigned int time_max_limit;
96 unsigned int time_last_search;
97 unsigned int time_response;
98 unsigned int ponder_move;
107 SHARE int fmg_misc_king;
108 SHARE int fmg_cap_king;
109 unsigned int ponder_move_list[ MAX_LEGAL_MOVES ];
111 SHARE int root_abort;
121 int log2_ntrans_table;
133 int resign_threshold;
134 int amaterial_save[NUM_UNMAKE];
135 int alast_root_value_save[NUM_UNMAKE];
139 short pc_on_sq[nsquare][pos_n];
140 short kkp[nsquare][nsquare][kkp_end];
141 unsigned char ansuc_check_save[NUM_UNMAKE];
142 unsigned char book_section[ MAX_SIZE_SECTION+1 ];
143 unsigned char adirec[ nsquare ][ nsquare ];
144 unsigned char is_same[ 16 ][ 16 ];
145 char str_cmdline[ SIZE_CMDLINE ];
146 char str_message[ SIZE_MESSAGE ];
147 char str_buffer_cmdline[ SIZE_CMDBUFFER ];
148 const char *str_error;
154 pv_t mpv_pv[ MPV_MAX_PV*2 + 1 ];
158 unsigned int dfpn_hash_log2;
162 # if ! defined(_WIN32) && ( defined(DFPN_CLIENT) || defined(TLP) )
163 pthread_attr_t pthread_attr;
166 #if defined(TLP) || defined(DFPN_CLIENT)
170 #if defined(DFPN_CLIENT)
171 volatile sckt_t dfpn_client_sckt;
172 volatile int dfpn_client_flag_read;
173 volatile unsigned int dfpn_client_move_unlocked;
174 volatile int dfpn_client_rresult_unlocked;
175 volatile int dfpn_client_rresult;
176 volatile int dfpn_client_num_cresult;
177 volatile char dfpn_client_signature[ DFPN_CLIENT_SIZE_SIGNATURE ];
178 volatile dfpn_client_cresult_t dfpn_client_cresult[ MAX_LEGAL_MOVES ];
179 volatile char dfpn_client_str_move[7];
180 unsigned int dfpn_client_best_move;
181 lock_t dfpn_client_lock;
182 char dfpn_client_str_addr[256];
183 int dfpn_client_port;
184 int dfpn_client_cresult_index;
189 tree_t tlp_atree_work[ TLP_NUM_WORK ];
190 tree_t * volatile tlp_ptrees[ TLP_MAX_THREADS ];
191 volatile int tlp_abort;
192 volatile int tlp_idle;
193 volatile int tlp_num;
202 #if ! defined(_WIN32)
206 #if ! defined(NO_LOGGING)
208 const char *str_dir_logs = "log";
211 #if defined(CSA_LAN)||defined(MNJ_LAN)|| defined(DFPN_CLIENT)|| defined(DFPN)
212 unsigned int time_last_send;
220 char client_str_addr[256];
221 char client_str_id[256];
222 char client_str_pwd[256];
226 #if defined(MNJ_LAN) || defined(USI) || defined(XBOARD)
227 unsigned int moves_ignore[MAX_LEGAL_MOVES];
233 int mnj_depth_stable;
234 unsigned int mnj_moves_ignore[MAX_LEGAL_MOVES];
238 enum usi_mode usi_mode;
239 unsigned int usi_time_out_last;
240 unsigned int usi_byoyomi;
243 check_table_t b_chk_tbl[nsquare];
244 check_table_t w_chk_tbl[nsquare];
246 #if defined(_MSC_VER)
247 #elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
249 unsigned char aifirst_one[512];
250 unsigned char ailast_one[512];
254 # if ! defined(CSASHOGI)
255 const char *str_myname = ( "Bonanza " BNZ_VER );
257 const char *str_myname = ( "Bonanza " BNZ_VER );
260 const char *str_myname = ( "Bonanza " BNZ_VER " Debug Build ("
261 __TIME__ " " __DATE__ ")" );
264 #if defined(DBG_EASY)
265 unsigned int easy_move;
268 #if defined(INANIWA_SHIFT)
272 const char *str_resign = "%TORYO";
273 const char *str_repetition = "%SENNICHITE";
274 const char *str_jishogi = "%JISHOGI";
275 const char *str_record_error = "%ERROR";
276 const char *str_delimiters = " \t,";
277 const char *str_fmt_line = "Line %u: %s";
278 const char *str_on = "on";
279 const char *str_off = "off";
280 const char *str_book = "book.bin";
281 const char *str_fv = "fv.bin";
282 const char *str_book_error = "invalid opening book";
283 const char *str_io_error = "I/O error";
284 const char *str_perpet_check = "perpetual check";
285 const char *str_bad_cmdline = "invalid command line";
286 const char *str_busy_think = "I'm busy in thinking now";
287 const char *str_bad_record = "invalid record of game";
288 const char *str_bad_board = "invalid board representation";
289 const char *str_illegal_move = "illegal move";
290 const char *str_double_pawn = "double pawn";
291 const char *str_mate_drppawn = "mated by a droped pawn";
292 const char *str_unexpect_eof = "unexpected end of file";
293 const char *str_king_hang = "The king is hang.";
294 const char *str_game_ended = "move after a game was concluded";
295 const char *str_fopen_error = "Can't open a file";
296 const char *str_ovrflw_line = "Too many characters in a line.";
297 const char *str_no_legal_move = "No legal moves to search";
298 const char *str_warning = "WARNING: ";
300 const char *str_server_err = "received invalid message from the server";
303 const char *astr_table_piece[16] = { "* ", "FU", "KY", "KE", "GI", "KI",
304 "KA", "HI", "OU", "TO", "NY", "NK",
305 "NG", "##", "UM", "RY" };
307 const char ach_turn[2] = { '+', '-' };
309 const int ashell_h[ SHELL_H_LEN ] = { 1, 3, 7, 15, 31, 63, 127 };
311 const int aikpp[31] = { e_dragon, e_horse, 0, e_gold,
312 e_gold, e_gold, e_gold, 0,
313 e_rook, e_bishop, e_gold, e_silver,
314 e_knight, e_lance, e_pawn, 0,
315 f_pawn, f_lance, f_knight,
316 f_silver, f_gold, f_bishop, f_rook,
317 0, f_gold, f_gold, f_gold,
318 f_gold, 0, f_horse, f_dragon };
320 const int aikkp[16] = { 0, kkp_pawn, kkp_lance, kkp_knight,
321 kkp_silver, kkp_gold, kkp_bishop, kkp_rook,
322 0, kkp_gold, kkp_gold, kkp_gold,
323 kkp_gold, kkp_gold, kkp_horse, kkp_dragon };
325 const int aikkp_hand[8] = { 0, kkp_hand_pawn, kkp_hand_lance,
326 kkp_hand_knight, kkp_hand_silver, kkp_hand_gold,
327 kkp_hand_bishop, kkp_hand_rook };
329 const unsigned char aifile[ nsquare ]= {
330 file1, file2, file3, file4, file5, file6, file7, file8, file9,
331 file1, file2, file3, file4, file5, file6, file7, file8, file9,
332 file1, file2, file3, file4, file5, file6, file7, file8, file9,
333 file1, file2, file3, file4, file5, file6, file7, file8, file9,
334 file1, file2, file3, file4, file5, file6, file7, file8, file9,
335 file1, file2, file3, file4, file5, file6, file7, file8, file9,
336 file1, file2, file3, file4, file5, file6, file7, file8, file9,
337 file1, file2, file3, file4, file5, file6, file7, file8, file9,
338 file1, file2, file3, file4, file5, file6, file7, file8, file9 };
340 const unsigned char airank[ nsquare ]= {
341 rank1, rank1, rank1, rank1, rank1, rank1, rank1, rank1, rank1,
342 rank2, rank2, rank2, rank2, rank2, rank2, rank2, rank2, rank2,
343 rank3, rank3, rank3, rank3, rank3, rank3, rank3, rank3, rank3,
344 rank4, rank4, rank4, rank4, rank4, rank4, rank4, rank4, rank4,
345 rank5, rank5, rank5, rank5, rank5, rank5, rank5, rank5, rank5,
346 rank6, rank6, rank6, rank6, rank6, rank6, rank6, rank6, rank6,
347 rank7, rank7, rank7, rank7, rank7, rank7, rank7, rank7, rank7,
348 rank8, rank8, rank8, rank8, rank8, rank8, rank8, rank8, rank8,
349 rank9, rank9, rank9, rank9, rank9, rank9, rank9, rank9, rank9 };
351 const min_posi_t min_posi_no_handicap = {
353 { -lance, -knight, -silver, -gold, -king, -gold, -silver, -knight, -lance,
354 empty, -rook, empty, empty, empty, empty, empty, -bishop, empty,
355 -pawn, -pawn, -pawn, -pawn, -pawn, -pawn, -pawn, -pawn, -pawn,
356 empty, empty, empty, empty, empty, empty, empty, empty, empty,
357 empty, empty, empty, empty, empty, empty, empty, empty, empty,
358 empty, empty, empty, empty, empty, empty, empty, empty, empty,
359 pawn, pawn, pawn, pawn, pawn, pawn, pawn, pawn, pawn,
360 empty, bishop, empty, empty, empty, empty, empty, rook, empty,
361 lance, knight, silver, gold, king, gold, silver, knight, lance } };