Subversion Repositories Games.Chess Giants

Rev

Rev 33 | Rev 154 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 33 Rev 108
Line 1... Line 1...
1
#include "chess.h"
1
#include "chess.h"
2
/* *INDENT-OFF* */#if !defined(INLINEASM)
2
/* *INDENT-OFF* */#if !defined(INLINEASM)
3
unsigned char msb[65536];
3
unsigned char msb[65536];
4
unsigned char lsb[65536];
4
unsigned char lsb[65536];
5
#endif
5
#endif
6
unsigned char msb_8bit[256];
6
unsigned char msb_8bit[256];
7
unsigned char lsb_8bit[256];
7
unsigned char lsb_8bit[256];
8
unsigned char pop_cnt_8bit[256];
8
unsigned char pop_cnt_8bit[256];
9
unsigned char is_outside[256][256];
9
uint64_t mask_pawn_connected[2][64];
10
uint64_t mask_pawn_connected[64];
10
uint64_t mask_pawn_isolated[64];
11
uint64_t mask_pawn_isolated[64];
11
uint64_t mask_passed[2][64];
12
uint64_t mask_passed[2][64];
-
 
13
uint64_t mask_no_pattacks[2][64];
-
 
14
uint64_t mask_hidden_left[2][8];
-
 
15
uint64_t mask_hidden_right[2][8];
12
uint64_t mask_pattacks[2][64];
16
uint64_t pawn_race[2][2][64];
13
uint64_t pawn_race[2][2][64];
17
BOOK_POSITION book_buffer[BOOK_CLUSTER_SIZE];
14
BOOK_POSITION book_buffer[BOOK_CLUSTER_SIZE];
18
BOOK_POSITION book_buffer_char[BOOK_CLUSTER_SIZE];
15
BOOK_POSITION book_buffer_char[BOOK_CLUSTER_SIZE];
19
int OOsqs[2][3] = {{ E8, F8, G8 }, { E1, F1, G1 }};
16
const int OOsqs[2][3] =  {{E8, F8, G8}, {E1, F1, G1}};
Line 29... Line 26...
29
int call_flag = 0;
26
int call_flag = 0;
30
int crafty_rating = 2500;
27
int crafty_rating = 2500;
31
int opponent_rating = 2500;
28
int opponent_rating = 2500;
32
int last_search_value = 0;
29
int last_search_value = 0;
33
int pruning_margin[10] = {0, 100, 100, 200, 200, 300, 300, 400};
30
int pruning_margin[10] = {0, 100, 150, 200, 250, 300, 400, 500, 600, 700};
34
int pruning_depth = 6;
31
int pruning_depth = 7;
35
int pgn_suggested_percent = 0;
32
int movecnt_pruning[4] = {0, 12, 15, 18};
36
char pgn_event[128] = { "?" };
33
int movecnt_depth = 3;
37
char pgn_site[128] = { "?" };
34
int pgn_suggested_percent = 0;
38
char pgn_date[128] = { "????.??.??" };
35
char pgn_event[128] = {"?"};
39
char pgn_round[128] = { "?" };
36
char pgn_site[128] = {"?"};
Line 41... Line 38...
41
char pgn_white_elo[128] = { "" };
38
char pgn_round[128] = {"?"};
42
char pgn_black[128] = { "Crafty " VERSION };
39
char pgn_white[128] = {"unknown"};
43
char pgn_black_elo[128] = { "" };
40
char pgn_white_elo[128] = {""};
44
char pgn_result[128] = { "*" };
41
char pgn_black[128] = {"Crafty " VERSION};
45
char *B_list[128];
42
char pgn_black_elo[128] = {""};
46
char *AK_list[128];
43
char pgn_result[128] = {"*"};
47
char *GM_list[128];
44
char *B_list[128];
48
char *IM_list[128];
45
char *AK_list[128];
-
 
46
char *GM_list[128];
49
char *SP_list[128];
47
char *IM_list[128];
50
char *SP_opening_filename[128];
48
char *SP_list[128];
51
char *SP_personality_filename[128];
49
char *SP_opening_filename[128];
52
int output_format = 0;
50
char *SP_personality_filename[128];
53
#if !defined(NOEGTB)
-
 
54
int EGTBlimit = 0;
-
 
55
int EGTB_use = 0;
-
 
56
int EGTB_draw = 0;
-
 
57
int EGTB_search = 0;
-
 
58
size_t EGTB_cache_size = 4096 * 4096;
-
 
59
void *EGTB_cache = (void *) 0;
-
 
60
int EGTB_setup = 0;
-
 
61
#endif
-
 
62
int xboard = 0;
51
int output_format = 0;
-
 
52
#if !defined(NOEGTB)
-
 
53
int EGTBlimit = 0;
-
 
54
int EGTB_use = 0;
63
int pong = 0;
55
int EGTB_draw = 0;
64
int early_exit = 99;
56
int EGTB_depth = 6;
65
int new_game = 0;
57
size_t EGTB_cache_size = 4096 * 4096;
66
char book_path[128] = { BOOKDIR };
58
void *EGTB_cache = (void *) 0;
67
char log_path[128] = { LOGDIR };
59
int EGTB_setup = 0;
68
char tb_path[128] = { TBDIR };
60
#endif
69
char rc_path[128] = { RCDIR };
61
int xboard = 0;
70
int initialized = 0;
62
int xboard_done = 0;
71
int kibitz = 0;
63
int pong = 0;
72
int post = 0;
64
int early_exit = 99;
73
int log_id = 0;
65
int new_game = 0;
74
int game_wtm = 1;
66
char book_path[128] = {BOOKDIR};
75
int last_opponent_move = 0;
67
char log_path[128] = {LOGDIR};
76
int check_depth = 1;
68
char tb_path[128] = {TBDIR};
77
int null_depth = 3;               /* R=3 */
69
char rc_path[128] = {RCDIR};
78
int LMR_remaining_depth = 1;      /* leave 1 full ply after reductions */
70
int initialized = 0;
79
int LMR_min_reduction = 1;        /* minimum reduction 1 ply */
71
int kibitz = 0;
80
int LMR_max_reduction = 2;        /* maximum reduction 2 plies */
72
int post = 0;
81
int search_depth = 0;
73
int log_id = 0;
82
/*uint64_t*/ unsigned int search_nodes = 0; // Pierre-Marie Baty -- fixed type
74
int game_wtm = 1;
83
/*uint64_t*/ unsigned int temp_search_nodes = 0; // Pierre-Marie Baty -- fixed type
75
int last_opponent_move = 0;
84
int search_move = 0;
76
int check_depth = 1;                  /* extend checks one ply                */
85
int predicted = 0;
77
int null_depth = 3;                   /* R=3 + (next line)                    */
86
int time_used = 0;
78
int null_divisor = 6;                 /* R = null_depth + depth / 6           */
87
int time_used_opponent = 0;
79
int LMR_rdepth = 1;                   /* leave 1 full ply after reductions    */
88
int analyze_mode = 0;
80
int LMR_min= 1;                       /* minimum reduction 1 ply              */
89
int annotate_mode = 0;
81
int LMR_max= 15;                      /* maximum reduction 15 plies           */
90
int input_status = 0;
82
double LMR_db = 1.8;                  /* depth is 1.8x as important as        */
91
int resign = 9;
83
double LMR_mb = 1.0;                  /* moves searched in the formula.       */
92
int resign_counter = 0;
84
double LMR_s = 2.0;                   /* smaller numbers increase reductions. */
93
int resign_count = 5;
85
uint8_t LMR[32][64];
94
int draw_counter = 0;
86
int rep_index;
95
int draw_count = 5;
87
int search_depth = 0;
96
int draw_offer_pending = 0;
88
uint64_t search_nodes = 0;
97
int draw_offered = 0;
89
uint64_t temp_search_nodes = 0;
98
int offer_draws = 1;
90
int search_move = 0;
99
int adaptive_hash = 0;
91
int predicted = 0;
100
size_t adaptive_hash_min = 0;
92
int time_used = 0;
101
size_t adaptive_hash_max = 0;
93
int time_used_opponent = 0;
102
size_t adaptive_hashp_min = 0;
94
int analyze_mode = 0;
103
size_t adaptive_hashp_max = 0;
95
int annotate_mode = 0;
104
int time_limit = 100;
96
int input_status = 0;
105
int force = 0;
97
int resign = 9;
106
char initial_position[80] = { "" };
98
int resign_counter = 0;
107
char hint[512] = { "" };
99
int resign_count = 5;
108
char book_hint[512] = { "" };
100
int draw_counter = 0;
109
int over = 0;
101
int draw_count = 5;
110
int usage_level = 0;
102
int draw_offer_pending = 0;
111
char audible_alarm = 0x07;
103
int draw_offered = 0;
112
char speech = 0;
104
int offer_draws = 1;
113
int book_accept_mask = ~03;
105
int dynamic_draw_score = 1;
114
int book_reject_mask = 3;
106
int adaptive_hash = 0;
115
int book_random = 1;
107
size_t adaptive_hash_min = 0;
116
float book_weight_learn = 1.0;
108
size_t adaptive_hash_max = 0;
117
float book_weight_freq = 1.0;
109
size_t adaptive_hashp_min = 0;
118
float book_weight_eval = 0.1f; // Pierre-Marie Baty -- added float suffix
110
size_t adaptive_hashp_max = 0;
119
int book_search_trigger = 20;
111
int time_limit = 100;
120
int learn = 1;
112
int force = 0;
121
int learning = 100;
113
char initial_position[80] = {""};
122
int learn_value = 0;
114
char ponder_text[512] = {""};
123
int abort_search;      /*  1 = abort / print stats, 2 = abort no print stats */
115
char book_hint[512] = {""};
124
int iteration_depth;
116
int over = 0;
125
int root_wtm;
117
int usage_level = 0;
126
int root_beta;
118
char audible_alarm = 0x07;
127
int last_root_value;
119
char speech = 0;
128
ROOT_MOVE root_moves[256];
120
int book_accept_mask = ~03;
129
int n_root_moves;
121
int book_reject_mask = 3;
130
int difficulty;
122
int book_random = 1;
131
int absolute_time_limit;
123
float book_weight_learn = 1.0;
132
int search_time_limit;
124
float book_weight_freq = 1.0;
133
int burp;
125
float book_weight_eval = 0.1f; // Pierre-Marie Baty -- added type cast
134
int quit = 0;
126
int book_search_trigger = 20;
135
unsigned int opponent_start_time, opponent_end_time;
127
int learn = 1;
136
unsigned int program_start_time, program_end_time;
128
int learning = 100;
137
unsigned int start_time, end_time;
129
int learn_value = 0;
138
TREE *block[MAX_BLOCKS + 1];
130
int abort_search;      /*  1 = abort / print stats, 2 = abort no print stats */
139
THREAD thread[CPUS];
131
int iteration;
140
#if (CPUS > 1)
132
int root_wtm = 1;
141
lock_t lock_split, lock_smp, lock_io, lock_root;
133
int last_root_value;
142
#if defined(UNIX)
134
ROOT_MOVE root_moves[256];
143
  pthread_attr_t attributes;
135
int n_root_moves;
144
#endif
136
int difficulty;
145
#endif
137
int absolute_time_limit;
146
int smp_max_threads = 0;
138
int search_time_limit;
147
int smp_split_group = 5;           /* max threads per group - 1 */
139
int burp;
148
int smp_split_at_root = 1;
140
int quit = 0;
149
int smp_min_split_depth = 5;
141
unsigned opponent_start_time, opponent_end_time;
150
unsigned int smp_split_nodes = 2000;
142
unsigned program_start_time, program_end_time;
151
unsigned int parallel_splits;
143
unsigned start_time, end_time;
152
unsigned int parallel_aborts;
144
TREE *block[MAX_BLOCKS + 1];
153
unsigned int idle_time;
145
THREAD thread[CPUS];
154
unsigned int max_split_blocks = 0;
146
#if (CPUS > 1)
155
unsigned int idle_percent = 0;
147
lock_t lock_smp, lock_io;
156
volatile int smp_idle = 0;
148
#if defined(UNIX)
157
volatile int smp_split = 0;
149
  pthread_attr_t attributes;
158
volatile int smp_threads = 0;
150
#endif
159
volatile int initialized_threads = 0;
151
#endif
160
int crafty_is_white = 0;
152
unsigned int smp_max_threads = 0;
161
unsigned int nodes_between_time_checks = 1000000;
153
unsigned int smp_split_group = 8;       /* max threads per group              */
162
unsigned int nodes_per_second = 1000000;
154
unsigned int smp_split_at_root = 1;     /* enable split at root               */
163
int next_time_check = 100000;
155
unsigned int smp_min_split_depth = 5;   /* don't split within 5 plies of tips */
164
int transposition_age = 0;
156
unsigned int smp_gratuitous_depth = 10; /* gratuitous splits if depth > 10    */
165
int thinking = 0;
157
unsigned int smp_gratuitous_limit = 6;  /* max gratuitous splits / thread     */
166
int pondering = 0;
158
int smp_affinity = 0;                   /* anything >= 0 is enabled           */
167
int puzzling = 0;
159
int smp_numa = 0;                       /* disables NUMA mode by default      */
168
int booking = 0;
160
                                        /* enable if you really have NUMA     */
169
int display_options = 4095 - 256 - 512;
161
/*
170
unsigned int noise_level = 200000;
162
      This is the autotune configuration section.  Each line represents one
171
int noise_block = 0;
163
      smp search parameter that can be tuned.  The first three values are the
172
int tc_moves = 60;
164
      min, max and increment that autotune will use for this paramenter.  The
173
int tc_time = 180000;
165
      fourth parameter is a string autotune will display to explain what it is
174
int tc_time_remaining[2] = { 180000, 180000 };
166
      currently tuning.  The fifth parameter is the command used to change this
175
int tc_moves_remaining[2] = { 60, 60 };
167
      parameter (this is added to the .craftyrc/crafty.rc file after tuning is
176
int tc_secondary_moves = 30;
168
      completed.  The last parameter is a pointer to the variable that must be
177
int tc_secondary_time = 90000;
169
      changed to adjust the parameter while running the autotune tests.
178
int tc_increment = 0;
170
*/
179
int tc_sudden_death = 0;
171
int autotune_params = 4;
180
int tc_operator_time = 0;
172
struct autotune tune[16] = {
181
int tc_safety_margin = 0;
173
  { 4, 20, 4, "max thread group", "smpgroup", &smp_split_group},
182
int draw_score[2] = { 0, 0 };
174
  { 4,  8, 1, "min split depth", "smpmin", &smp_min_split_depth},
183
char kibitz_text[4096];
175
  {10, 16, 2, "min gratuitous split depth", "smpgsd", &smp_gratuitous_depth},
184
int kibitz_depth;
176
  { 1,  8, 2, "gratuitous split limit", "smpgsl", &smp_gratuitous_limit},
185
int move_number = 1;
177
};
186
int moves_out_of_book = 0;
178
unsigned parallel_splits;
187
int first_nonbook_factor = 0;
179
unsigned parallel_splits_wasted;
188
int first_nonbook_span = 0;
180
unsigned parallel_aborts;
189
int smp_nice = 1;
181
unsigned parallel_joins;
190
#if defined(SKILL)
182
unsigned busy_percent = 0;
191
int skill = 100;
183
uint64_t game_max_blocks = 0;
192
#endif
184
volatile int smp_split = 0;
193
int show_book = 0;
185
volatile int smp_threads = 0;
194
int book_selection_width = 5;
186
volatile int initialized_threads = 0;
195
int ponder = 1;
187
int crafty_is_white = 0;
196
int trace_level = 0;
188
unsigned nodes_between_time_checks = 1000000;
197
/*  for the following 6 lines, each pair should have */
189
unsigned nodes_per_second = 1000000;
198
/*  the same numeric value (the size value).         */
190
int next_time_check = 100000;
199
size_t hash_table_size = 524288;
191
int transposition_age = 0;
200
uint64_t hash_mask = (524288 -1) & ~3;
192
int thinking = 0;
201
size_t hash_path_size = 65536;
193
int pondering = 0;
202
uint64_t hash_path_mask = (65536 - 1) & ~15;
194
int puzzling = 0;
203
size_t pawn_hash_table_size = 16384;
195
int booking = 0;
204
uint64_t pawn_hash_mask = 16384 - 1;
196
/************************************************************
205
int abs_draw_score = 1;
197
 *                                                          *
206
int accept_draws = 1;
198
 *    1 -> display move/time/results/etc.                   *
207
const char translate[13] =
199
 *    2 -> display PV.                                      *
208
    { 'k', 'q', 'r', 'b', 'n', 'p', 0, 'P', 'N', 'B', 'R', 'Q', 'K' };
200
 *    4 -> display fail high / fail low moves               *
209
int16_t knight_mobility_table[64];
201
 *    8 -> display search statistics.                       *
210
uint64_t magic_bishop[64] = {
202
 *   16 -> display root moves as they are searched.         *
211
  0x0002020202020200ull, 0x0002020202020000ull, 0x0004010202000000ull,
203
 *   32 -> display general informational messages.          *
212
  0x0004040080000000ull, 0x0001104000000000ull, 0x0000821040000000ull,
204
 *   64 -> display ply-1 move list / flags after each       *
213
  0x0000410410400000ull, 0x0000104104104000ull, 0x0000040404040400ull,
205
 *           iteration.                                     *
214
  0x0000020202020200ull, 0x0000040102020000ull, 0x0000040400800000ull,
206
 *  128 -> display root moves and scores before search      *
215
  0x0000011040000000ull, 0x0000008210400000ull, 0x0000004104104000ull,
207
 *           begins.                                        *
216
  0x0000002082082000ull, 0x0004000808080800ull, 0x0002000404040400ull,
208
 * 2048 -> error messages (can not be disabled).            *
217
  0x0001000202020200ull, 0x0000800802004000ull, 0x0000800400A00000ull,
209
 *                                                          *
218
  0x0000200100884000ull, 0x0000400082082000ull, 0x0000200041041000ull,
210
 ************************************************************
219
  0x0002080010101000ull, 0x0001040008080800ull, 0x0000208004010400ull,
211
 */
220
  0x0000404004010200ull, 0x0000840000802000ull, 0x0000404002011000ull,
212
int display_options = 1 | 2 | 8 | 16 | 32 | 2048;
221
  0x0000808001041000ull, 0x0000404000820800ull, 0x0001041000202000ull,
213
unsigned noise_level = 100;
222
  0x0000820800101000ull, 0x0000104400080800ull, 0x0000020080080080ull,
214
int noise_block = 0;
223
  0x0000404040040100ull, 0x0000808100020100ull, 0x0001010100020800ull,
215
int tc_moves = 60;
224
  0x0000808080010400ull, 0x0000820820004000ull, 0x0000410410002000ull,
216
int tc_time = 180000;
225
  0x0000082088001000ull, 0x0000002011000800ull, 0x0000080100400400ull,
217
int tc_time_remaining[2] = {180000, 180000};
226
  0x0001010101000200ull, 0x0002020202000400ull, 0x0001010101000200ull,
218
int tc_moves_remaining[2] = {60, 60};
227
  0x0000410410400000ull, 0x0000208208200000ull, 0x0000002084100000ull,
219
int tc_secondary_moves = 30;
228
  0x0000000020880000ull, 0x0000001002020000ull, 0x0000040408020000ull,
220
int tc_secondary_time = 90000;
229
  0x0004040404040000ull, 0x0002020202020000ull, 0x0000104104104000ull,
221
int tc_increment = 0;
230
  0x0000002082082000ull, 0x0000000020841000ull, 0x0000000000208800ull,
222
int tc_sudden_death = 0;
231
  0x0000000010020200ull, 0x0000000404080200ull, 0x0000040404040400ull,
223
int tc_safety_margin = 0;
232
  0x0002020202020200ull
224
int draw_score[2] = {0, 0};
233
};
225
char kibitz_text[4096];
234
uint64_t magic_bishop_mask[64] = {
226
int kibitz_depth;
235
  0x0040201008040200ull, 0x0000402010080400ull, 0x0000004020100A00ull,
227
int move_number = 1;
236
  0x0000000040221400ull, 0x0000000002442800ull, 0x0000000204085000ull,
228
int moves_out_of_book = 0;
237
  0x0000020408102000ull, 0x0002040810204000ull, 0x0020100804020000ull,
229
int first_nonbook_factor = 0;
238
  0x0040201008040000ull, 0x00004020100A0000ull, 0x0000004022140000ull,
230
int first_nonbook_span = 0;
239
  0x0000000244280000ull, 0x0000020408500000ull, 0x0002040810200000ull,
231
int smp_nice = 1;
240
  0x0004081020400000ull, 0x0010080402000200ull, 0x0020100804000400ull,
232
#if defined(SKILL)
241
  0x004020100A000A00ull, 0x0000402214001400ull, 0x0000024428002800ull,
233
int skill = 100;
242
  0x0002040850005000ull, 0x0004081020002000ull, 0x0008102040004000ull,
234
#endif
243
  0x0008040200020400ull, 0x0010080400040800ull, 0x0020100A000A1000ull,
235
int show_book = 0;
244
  0x0040221400142200ull, 0x0002442800284400ull, 0x0004085000500800ull,
236
int book_selection_width = 5;
245
  0x0008102000201000ull, 0x0010204000402000ull, 0x0004020002040800ull,
237
int ponder = 1;
246
  0x0008040004081000ull, 0x00100A000A102000ull, 0x0022140014224000ull,
238
int trace_level = 0;
247
  0x0044280028440200ull, 0x0008500050080400ull, 0x0010200020100800ull,
239
/*  for the following 6 lines, each pair should have */
248
  0x0020400040201000ull, 0x0002000204081000ull, 0x0004000408102000ull,
240
/*  the same numeric value (the size value).         */
249
  0x000A000A10204000ull, 0x0014001422400000ull, 0x0028002844020000ull,
241
size_t hash_table_size = 1ull << 20;
250
  0x0050005008040200ull, 0x0020002010080400ull, 0x0040004020100800ull,
242
uint64_t hash_mask = ((1ull << 20) - 1) & ~3;
251
  0x0000020408102000ull, 0x0000040810204000ull, 0x00000A1020400000ull,
243
size_t hash_path_size = 1ull << 16;
252
  0x0000142240000000ull, 0x0000284402000000ull, 0x0000500804020000ull,
244
uint64_t hash_path_mask = ((1ull << 16) - 1) & ~15;
253
  0x0000201008040200ull, 0x0000402010080400ull, 0x0002040810204000ull,
245
size_t pawn_hash_table_size = 1ull << 18;
254
  0x0004081020400000ull, 0x000A102040000000ull, 0x0014224000000000ull,
246
uint64_t pawn_hash_mask = (1ull << 18) - 1;
255
  0x0028440200000000ull, 0x0050080402000000ull, 0x0020100804020000ull,
247
uint64_t mask_clear_entry = 0xff9ffffffffe0000ull;
256
  0x0040201008040200ull
248
size_t eval_hash_table_size = 65536;
257
};
249
uint64_t eval_hash_mask = 65536 - 1;
258
unsigned int magic_bishop_shift[64] = {
250
int abs_draw_score = 0;
259
  58, 59, 59, 59, 59, 59, 59, 58,
251
int accept_draws = 1;
260
  59, 59, 59, 59, 59, 59, 59, 59,
252
const char translate[13] =
261
  59, 59, 57, 57, 57, 57, 59, 59,
253
    {'k', 'q', 'r', 'b', 'n', 'p', 0, 'P', 'N', 'B', 'R', 'Q', 'K'};
262
  59, 59, 57, 55, 55, 57, 59, 59,
254
const uint64_t magic_bishop[64] = {
263
  59, 59, 57, 55, 55, 57, 59, 59,
255
  0x0002020202020200ull, 0x0002020202020000ull, 0x0004010202000000ull,
264
  59, 59, 57, 57, 57, 57, 59, 59,
256
  0x0004040080000000ull, 0x0001104000000000ull, 0x0000821040000000ull,
265
  59, 59, 59, 59, 59, 59, 59, 59,
257
  0x0000410410400000ull, 0x0000104104104000ull, 0x0000040404040400ull,
266
  58, 59, 59, 59, 59, 59, 59, 58
258
  0x0000020202020200ull, 0x0000040102020000ull, 0x0000040400800000ull,
267
};
259
  0x0000011040000000ull, 0x0000008210400000ull, 0x0000004104104000ull,
268
uint64_t magic_bishop_table[5248];
260
  0x0000002082082000ull, 0x0004000808080800ull, 0x0002000404040400ull,
269
uint64_t *magic_bishop_indices[64] = {
261
  0x0001000202020200ull, 0x0000800802004000ull, 0x0000800400A00000ull,
270
  magic_bishop_table + 4992, magic_bishop_table + 2624,
262
  0x0000200100884000ull, 0x0000400082082000ull, 0x0000200041041000ull,
271
  magic_bishop_table + 256, magic_bishop_table + 896,
263
  0x0002080010101000ull, 0x0001040008080800ull, 0x0000208004010400ull,
272
  magic_bishop_table + 1280, magic_bishop_table + 1664,
264
  0x0000404004010200ull, 0x0000840000802000ull, 0x0000404002011000ull,
273
  magic_bishop_table + 4800, magic_bishop_table + 5120,
265
  0x0000808001041000ull, 0x0000404000820800ull, 0x0001041000202000ull,
274
  magic_bishop_table + 2560, magic_bishop_table + 2656,
266
  0x0000820800101000ull, 0x0000104400080800ull, 0x0000020080080080ull,
275
  magic_bishop_table + 288, magic_bishop_table + 928,
267
  0x0000404040040100ull, 0x0000808100020100ull, 0x0001010100020800ull,
276
  magic_bishop_table + 1312, magic_bishop_table + 1696,
268
  0x0000808080010400ull, 0x0000820820004000ull, 0x0000410410002000ull,
277
  magic_bishop_table + 4832, magic_bishop_table + 4928,
269
  0x0000082088001000ull, 0x0000002011000800ull, 0x0000080100400400ull,
278
  magic_bishop_table + 0, magic_bishop_table + 128,
270
  0x0001010101000200ull, 0x0002020202000400ull, 0x0001010101000200ull,
279
  magic_bishop_table + 320, magic_bishop_table + 960,
271
  0x0000410410400000ull, 0x0000208208200000ull, 0x0000002084100000ull,
280
  magic_bishop_table + 1344, magic_bishop_table + 1728,
272
  0x0000000020880000ull, 0x0000001002020000ull, 0x0000040408020000ull,
281
  magic_bishop_table + 2304, magic_bishop_table + 2432,
273
  0x0004040404040000ull, 0x0002020202020000ull, 0x0000104104104000ull,
282
  magic_bishop_table + 32, magic_bishop_table + 160,
274
  0x0000002082082000ull, 0x0000000020841000ull, 0x0000000000208800ull,
283
  magic_bishop_table + 448, magic_bishop_table + 2752,
275
  0x0000000010020200ull, 0x0000000404080200ull, 0x0000040404040400ull,
284
  magic_bishop_table + 3776, magic_bishop_table + 1856,
276
  0x0002020202020200ull
285
  magic_bishop_table + 2336, magic_bishop_table + 2464,
277
};
286
  magic_bishop_table + 64, magic_bishop_table + 192,
278
const uint64_t magic_bishop_mask[64] = {
287
  magic_bishop_table + 576, magic_bishop_table + 3264,
279
  0x0040201008040200ull, 0x0000402010080400ull, 0x0000004020100A00ull,
288
  magic_bishop_table + 4288, magic_bishop_table + 1984,
280
  0x0000000040221400ull, 0x0000000002442800ull, 0x0000000204085000ull,
289
  magic_bishop_table + 2368, magic_bishop_table + 2496,
281
  0x0000020408102000ull, 0x0002040810204000ull, 0x0020100804020000ull,
290
  magic_bishop_table + 96, magic_bishop_table + 224,
282
  0x0040201008040000ull, 0x00004020100A0000ull, 0x0000004022140000ull,
291
  magic_bishop_table + 704, magic_bishop_table + 1088,
283
  0x0000000244280000ull, 0x0000020408500000ull, 0x0002040810200000ull,
292
  magic_bishop_table + 1472, magic_bishop_table + 2112,
284
  0x0004081020400000ull, 0x0010080402000200ull, 0x0020100804000400ull,
293
  magic_bishop_table + 2400, magic_bishop_table + 2528,
285
  0x004020100A000A00ull, 0x0000402214001400ull, 0x0000024428002800ull,
294
  magic_bishop_table + 2592, magic_bishop_table + 2688,
286
  0x0002040850005000ull, 0x0004081020002000ull, 0x0008102040004000ull,
295
  magic_bishop_table + 832, magic_bishop_table + 1216,
287
  0x0008040200020400ull, 0x0010080400040800ull, 0x0020100A000A1000ull,
296
  magic_bishop_table + 1600, magic_bishop_table + 2240,
288
  0x0040221400142200ull, 0x0002442800284400ull, 0x0004085000500800ull,
297
  magic_bishop_table + 4864, magic_bishop_table + 4960,
289
  0x0008102000201000ull, 0x0010204000402000ull, 0x0004020002040800ull,
298
  magic_bishop_table + 5056, magic_bishop_table + 2720,
290
  0x0008040004081000ull, 0x00100A000A102000ull, 0x0022140014224000ull,
299
  magic_bishop_table + 864, magic_bishop_table + 1248,
291
  0x0044280028440200ull, 0x0008500050080400ull, 0x0010200020100800ull,
300
  magic_bishop_table + 1632, magic_bishop_table + 2272,
292
  0x0020400040201000ull, 0x0002000204081000ull, 0x0004000408102000ull,
301
  magic_bishop_table + 4896, magic_bishop_table + 5184
293
  0x000A000A10204000ull, 0x0014001422400000ull, 0x0028002844020000ull,
302
};
294
  0x0050005008040200ull, 0x0020002010080400ull, 0x0040004020100800ull,
303
int16_t magic_bishop_mobility_table[5248];
295
  0x0000020408102000ull, 0x0000040810204000ull, 0x00000A1020400000ull,
304
int16_t *magic_bishop_mobility_indices[64] = {
296
  0x0000142240000000ull, 0x0000284402000000ull, 0x0000500804020000ull,
305
  magic_bishop_mobility_table + 4992, magic_bishop_mobility_table + 2624,
297
  0x0000201008040200ull, 0x0000402010080400ull, 0x0002040810204000ull,
306
  magic_bishop_mobility_table + 256, magic_bishop_mobility_table + 896,
298
  0x0004081020400000ull, 0x000A102040000000ull, 0x0014224000000000ull,
307
  magic_bishop_mobility_table + 1280, magic_bishop_mobility_table + 1664,
299
  0x0028440200000000ull, 0x0050080402000000ull, 0x0020100804020000ull,
308
  magic_bishop_mobility_table + 4800, magic_bishop_mobility_table + 5120,
300
  0x0040201008040200ull
309
  magic_bishop_mobility_table + 2560, magic_bishop_mobility_table + 2656,
301
};
310
  magic_bishop_mobility_table + 288, magic_bishop_mobility_table + 928,
302
const unsigned magic_bishop_shift[64] = {
311
  magic_bishop_mobility_table + 1312, magic_bishop_mobility_table + 1696,
303
  58, 59, 59, 59, 59, 59, 59, 58,
312
  magic_bishop_mobility_table + 4832, magic_bishop_mobility_table + 4928,
304
  59, 59, 59, 59, 59, 59, 59, 59,
313
  magic_bishop_mobility_table + 0, magic_bishop_mobility_table + 128,
305
  59, 59, 57, 57, 57, 57, 59, 59,
314
  magic_bishop_mobility_table + 320, magic_bishop_mobility_table + 960,
306
  59, 59, 57, 55, 55, 57, 59, 59,
315
  magic_bishop_mobility_table + 1344, magic_bishop_mobility_table + 1728,
307
  59, 59, 57, 55, 55, 57, 59, 59,
316
  magic_bishop_mobility_table + 2304, magic_bishop_mobility_table + 2432,
308
  59, 59, 57, 57, 57, 57, 59, 59,
317
  magic_bishop_mobility_table + 32, magic_bishop_mobility_table + 160,
309
  59, 59, 59, 59, 59, 59, 59, 59,
318
  magic_bishop_mobility_table + 448, magic_bishop_mobility_table + 2752,
310
  58, 59, 59, 59, 59, 59, 59, 58
319
  magic_bishop_mobility_table + 3776, magic_bishop_mobility_table + 1856,
311
};
320
  magic_bishop_mobility_table + 2336, magic_bishop_mobility_table + 2464,
312
uint64_t magic_bishop_table[5248];
321
  magic_bishop_mobility_table + 64, magic_bishop_mobility_table + 192,
313
uint64_t *magic_bishop_indices[64] = {
322
  magic_bishop_mobility_table + 576, magic_bishop_mobility_table + 3264,
314
  magic_bishop_table + 4992, magic_bishop_table + 2624,
323
  magic_bishop_mobility_table + 4288, magic_bishop_mobility_table + 1984,
315
  magic_bishop_table + 256, magic_bishop_table + 896,
324
  magic_bishop_mobility_table + 2368, magic_bishop_mobility_table + 2496,
316
  magic_bishop_table + 1280, magic_bishop_table + 1664,
325
  magic_bishop_mobility_table + 96, magic_bishop_mobility_table + 224,
317
  magic_bishop_table + 4800, magic_bishop_table + 5120,
326
  magic_bishop_mobility_table + 704, magic_bishop_mobility_table + 1088,
318
  magic_bishop_table + 2560, magic_bishop_table + 2656,
327
  magic_bishop_mobility_table + 1472, magic_bishop_mobility_table + 2112,
319
  magic_bishop_table + 288, magic_bishop_table + 928,
328
  magic_bishop_mobility_table + 2400, magic_bishop_mobility_table + 2528,
320
  magic_bishop_table + 1312, magic_bishop_table + 1696,
329
  magic_bishop_mobility_table + 2592, magic_bishop_mobility_table + 2688,
321
  magic_bishop_table + 4832, magic_bishop_table + 4928,
330
  magic_bishop_mobility_table + 832, magic_bishop_mobility_table + 1216,
322
  magic_bishop_table + 0, magic_bishop_table + 128,
331
  magic_bishop_mobility_table + 1600, magic_bishop_mobility_table + 2240,
323
  magic_bishop_table + 320, magic_bishop_table + 960,
332
  magic_bishop_mobility_table + 4864, magic_bishop_mobility_table + 4960,
324
  magic_bishop_table + 1344, magic_bishop_table + 1728,
333
  magic_bishop_mobility_table + 5056, magic_bishop_mobility_table + 2720,
325
  magic_bishop_table + 2304, magic_bishop_table + 2432,
334
  magic_bishop_mobility_table + 864, magic_bishop_mobility_table + 1248,
326
  magic_bishop_table + 32, magic_bishop_table + 160,
335
  magic_bishop_mobility_table + 1632, magic_bishop_mobility_table + 2272,
327
  magic_bishop_table + 448, magic_bishop_table + 2752,
336
  magic_bishop_mobility_table + 4896, magic_bishop_mobility_table + 5184
328
  magic_bishop_table + 3776, magic_bishop_table + 1856,
337
};
329
  magic_bishop_table + 2336, magic_bishop_table + 2464,
338
uint64_t magic_rook_table[102400];
330
  magic_bishop_table + 64, magic_bishop_table + 192,
339
uint64_t *magic_rook_indices[64] = {
331
  magic_bishop_table + 576, magic_bishop_table + 3264,
340
  magic_rook_table + 86016, magic_rook_table + 73728,
332
  magic_bishop_table + 4288, magic_bishop_table + 1984,
341
  magic_rook_table + 36864, magic_rook_table + 43008,
333
  magic_bishop_table + 2368, magic_bishop_table + 2496,
342
  magic_rook_table + 47104, magic_rook_table + 51200,
334
  magic_bishop_table + 96, magic_bishop_table + 224,
343
  magic_rook_table + 77824, magic_rook_table + 94208,
335
  magic_bishop_table + 704, magic_bishop_table + 1088,
344
  magic_rook_table + 69632, magic_rook_table + 32768,
336
  magic_bishop_table + 1472, magic_bishop_table + 2112,
345
  magic_rook_table + 38912, magic_rook_table + 10240,
337
  magic_bishop_table + 2400, magic_bishop_table + 2528,
346
  magic_rook_table + 14336, magic_rook_table + 53248,
338
  magic_bishop_table + 2592, magic_bishop_table + 2688,
347
  magic_rook_table + 57344, magic_rook_table + 81920,
339
  magic_bishop_table + 832, magic_bishop_table + 1216,
348
  magic_rook_table + 24576, magic_rook_table + 33792,
340
  magic_bishop_table + 1600, magic_bishop_table + 2240,
349
  magic_rook_table + 6144, magic_rook_table + 11264,
341
  magic_bishop_table + 4864, magic_bishop_table + 4960,
350
  magic_rook_table + 15360, magic_rook_table + 18432,
342
  magic_bishop_table + 5056, magic_bishop_table + 2720,
351
  magic_rook_table + 58368, magic_rook_table + 61440,
343
  magic_bishop_table + 864, magic_bishop_table + 1248,
352
  magic_rook_table + 26624, magic_rook_table + 4096,
344
  magic_bishop_table + 1632, magic_bishop_table + 2272,
353
  magic_rook_table + 7168, magic_rook_table + 0,
345
  magic_bishop_table + 4896, magic_bishop_table + 5184
354
  magic_rook_table + 2048, magic_rook_table + 19456,
346
};
355
  magic_rook_table + 22528, magic_rook_table + 63488,
347
int16_t magic_bishop_mobility_table[5248];
356
  magic_rook_table + 28672, magic_rook_table + 5120,
348
int16_t *magic_bishop_mobility_indices[64] = {
357
  magic_rook_table + 8192, magic_rook_table + 1024,
349
  magic_bishop_mobility_table + 4992, magic_bishop_mobility_table + 2624,
358
  magic_rook_table + 3072, magic_rook_table + 20480,
350
  magic_bishop_mobility_table + 256, magic_bishop_mobility_table + 896,
359
  magic_rook_table + 23552, magic_rook_table + 65536,
351
  magic_bishop_mobility_table + 1280, magic_bishop_mobility_table + 1664,
360
  magic_rook_table + 30720, magic_rook_table + 34816,
352
  magic_bishop_mobility_table + 4800, magic_bishop_mobility_table + 5120,
361
  magic_rook_table + 9216, magic_rook_table + 12288,
353
  magic_bishop_mobility_table + 2560, magic_bishop_mobility_table + 2656,
362
  magic_rook_table + 16384, magic_rook_table + 21504,
354
  magic_bishop_mobility_table + 288, magic_bishop_mobility_table + 928,
363
  magic_rook_table + 59392, magic_rook_table + 67584,
355
  magic_bishop_mobility_table + 1312, magic_bishop_mobility_table + 1696,
364
  magic_rook_table + 71680, magic_rook_table + 35840,
356
  magic_bishop_mobility_table + 4832, magic_bishop_mobility_table + 4928,
365
  magic_rook_table + 39936, magic_rook_table + 13312,
357
  magic_bishop_mobility_table + 0, magic_bishop_mobility_table + 128,
366
  magic_rook_table + 17408, magic_rook_table + 54272,
358
  magic_bishop_mobility_table + 320, magic_bishop_mobility_table + 960,
367
  magic_rook_table + 60416, magic_rook_table + 83968,
359
  magic_bishop_mobility_table + 1344, magic_bishop_mobility_table + 1728,
368
  magic_rook_table + 90112, magic_rook_table + 75776,
360
  magic_bishop_mobility_table + 2304, magic_bishop_mobility_table + 2432,
369
  magic_rook_table + 40960, magic_rook_table + 45056,
361
  magic_bishop_mobility_table + 32, magic_bishop_mobility_table + 160,
370
  magic_rook_table + 49152, magic_rook_table + 55296,
362
  magic_bishop_mobility_table + 448, magic_bishop_mobility_table + 2752,
371
  magic_rook_table + 79872, magic_rook_table + 98304
363
  magic_bishop_mobility_table + 3776, magic_bishop_mobility_table + 1856,
372
};
364
  magic_bishop_mobility_table + 2336, magic_bishop_mobility_table + 2464,
373
int16_t magic_rook_mobility_table[102400];
365
  magic_bishop_mobility_table + 64, magic_bishop_mobility_table + 192,
374
int16_t *magic_rook_mobility_indices[64] = {
366
  magic_bishop_mobility_table + 576, magic_bishop_mobility_table + 3264,
375
  magic_rook_mobility_table + 86016, magic_rook_mobility_table + 73728,
367
  magic_bishop_mobility_table + 4288, magic_bishop_mobility_table + 1984,
376
  magic_rook_mobility_table + 36864, magic_rook_mobility_table + 43008,
368
  magic_bishop_mobility_table + 2368, magic_bishop_mobility_table + 2496,
377
  magic_rook_mobility_table + 47104, magic_rook_mobility_table + 51200,
369
  magic_bishop_mobility_table + 96, magic_bishop_mobility_table + 224,
378
  magic_rook_mobility_table + 77824, magic_rook_mobility_table + 94208,
-
 
379
  magic_rook_mobility_table + 69632, magic_rook_mobility_table + 32768,
370
  magic_bishop_mobility_table + 704, magic_bishop_mobility_table + 1088,
380
  magic_rook_mobility_table + 38912, magic_rook_mobility_table + 10240,
371
  magic_bishop_mobility_table + 1472, magic_bishop_mobility_table + 2112,
381
  magic_rook_mobility_table + 14336, magic_rook_mobility_table + 53248,
372
  magic_bishop_mobility_table + 2400, magic_bishop_mobility_table + 2528,
382
  magic_rook_mobility_table + 57344, magic_rook_mobility_table + 81920,
373
  magic_bishop_mobility_table + 2592, magic_bishop_mobility_table + 2688,
383
  magic_rook_mobility_table + 24576, magic_rook_mobility_table + 33792,
374
  magic_bishop_mobility_table + 832, magic_bishop_mobility_table + 1216,
384
  magic_rook_mobility_table + 6144, magic_rook_mobility_table + 11264,
375
  magic_bishop_mobility_table + 1600, magic_bishop_mobility_table + 2240,
385
  magic_rook_mobility_table + 15360, magic_rook_mobility_table + 18432,
376
  magic_bishop_mobility_table + 4864, magic_bishop_mobility_table + 4960,
Line 409... Line 400...
409
  0x0080001020400080ull, 0x0040001000200040ull, 0x0080081000200080ull,
400
  magic_rook_table + 28672, magic_rook_table + 5120,
410
  0x0080040800100080ull, 0x0080020400080080ull, 0x0080010200040080ull,
401
  magic_rook_table + 8192, magic_rook_table + 1024,
411
  0x0080008001000200ull, 0x0080002040800100ull, 0x0000800020400080ull,
402
  magic_rook_table + 3072, magic_rook_table + 20480,
412
  0x0000400020005000ull, 0x0000801000200080ull, 0x0000800800100080ull,
403
  magic_rook_table + 23552, magic_rook_table + 65536,
413
  0x0000800400080080ull, 0x0000800200040080ull, 0x0000800100020080ull,
404
  magic_rook_table + 30720, magic_rook_table + 34816,
414
  0x0000800040800100ull, 0x0000208000400080ull, 0x0000404000201000ull,
405
  magic_rook_table + 9216, magic_rook_table + 12288,
415
  0x0000808010002000ull, 0x0000808008001000ull, 0x0000808004000800ull,
406
  magic_rook_table + 16384, magic_rook_table + 21504,
416
  0x0000808002000400ull, 0x0000010100020004ull, 0x0000020000408104ull,
407
  magic_rook_table + 59392, magic_rook_table + 67584,
417
  0x0000208080004000ull, 0x0000200040005000ull, 0x0000100080200080ull,
408
  magic_rook_table + 71680, magic_rook_table + 35840,
418
  0x0000080080100080ull, 0x0000040080080080ull, 0x0000020080040080ull,
409
  magic_rook_table + 39936, magic_rook_table + 13312,
419
  0x0000010080800200ull, 0x0000800080004100ull, 0x0000204000800080ull,
410
  magic_rook_table + 17408, magic_rook_table + 54272,
420
  0x0000200040401000ull, 0x0000100080802000ull, 0x0000080080801000ull,
411
  magic_rook_table + 60416, magic_rook_table + 83968,
421
  0x0000040080800800ull, 0x0000020080800400ull, 0x0000020001010004ull,
412
  magic_rook_table + 90112, magic_rook_table + 75776,
422
  0x0000800040800100ull, 0x0000204000808000ull, 0x0000200040008080ull,
413
  magic_rook_table + 40960, magic_rook_table + 45056,
423
  0x0000100020008080ull, 0x0000080010008080ull, 0x0000040008008080ull,
414
  magic_rook_table + 49152, magic_rook_table + 55296,
424
  0x0000020004008080ull, 0x0000010002008080ull, 0x0000004081020004ull,
415
  magic_rook_table + 79872, magic_rook_table + 98304
-
 
416
};
425
  0x0000204000800080ull, 0x0000200040008080ull, 0x0000100020008080ull,
417
int16_t magic_rook_mobility_table[102400];
426
  0x0000080010008080ull, 0x0000040008008080ull, 0x0000020004008080ull,
418
int16_t *magic_rook_mobility_indices[64] = {
427
  0x0000800100020080ull, 0x0000800041000080ull, 0x00FFFCDDFCED714Aull,
419
  magic_rook_mobility_table + 86016, magic_rook_mobility_table + 73728,
428
  0x007FFCDDFCED714Aull, 0x003FFFCDFFD88096ull, 0x0000040810002101ull,
420
  magic_rook_mobility_table + 36864, magic_rook_mobility_table + 43008,
429
  0x0001000204080011ull, 0x0001000204000801ull, 0x0001000082000401ull,
421
  magic_rook_mobility_table + 47104, magic_rook_mobility_table + 51200,
430
  0x0001FFFAABFAD1A2ull
422
  magic_rook_mobility_table + 77824, magic_rook_mobility_table + 94208,
431
};
423
  magic_rook_mobility_table + 69632, magic_rook_mobility_table + 32768,
432
uint64_t magic_rook_mask[64] = {
424
  magic_rook_mobility_table + 38912, magic_rook_mobility_table + 10240,
433
  0x000101010101017Eull, 0x000202020202027Cull, 0x000404040404047Aull,
425
  magic_rook_mobility_table + 14336, magic_rook_mobility_table + 53248,
434
  0x0008080808080876ull, 0x001010101010106Eull, 0x002020202020205Eull,
426
  magic_rook_mobility_table + 57344, magic_rook_mobility_table + 81920,
435
  0x004040404040403Eull, 0x008080808080807Eull, 0x0001010101017E00ull,
427
  magic_rook_mobility_table + 24576, magic_rook_mobility_table + 33792,
436
  0x0002020202027C00ull, 0x0004040404047A00ull, 0x0008080808087600ull,
-
 
437
  0x0010101010106E00ull, 0x0020202020205E00ull, 0x0040404040403E00ull,
428
  magic_rook_mobility_table + 6144, magic_rook_mobility_table + 11264,
438
  0x0080808080807E00ull, 0x00010101017E0100ull, 0x00020202027C0200ull,
429
  magic_rook_mobility_table + 15360, magic_rook_mobility_table + 18432,
439
  0x00040404047A0400ull, 0x0008080808760800ull, 0x00101010106E1000ull,
430
  magic_rook_mobility_table + 58368, magic_rook_mobility_table + 61440,
440
  0x00202020205E2000ull, 0x00404040403E4000ull, 0x00808080807E8000ull,
431
  magic_rook_mobility_table + 26624, magic_rook_mobility_table + 4096,
441
  0x000101017E010100ull, 0x000202027C020200ull, 0x000404047A040400ull,
432
  magic_rook_mobility_table + 7168, magic_rook_mobility_table + 0,
442
  0x0008080876080800ull, 0x001010106E101000ull, 0x002020205E202000ull,
433
  magic_rook_mobility_table + 2048, magic_rook_mobility_table + 19456,
443
  0x004040403E404000ull, 0x008080807E808000ull, 0x0001017E01010100ull,
434
  magic_rook_mobility_table + 22528, magic_rook_mobility_table + 63488,
444
  0x0002027C02020200ull, 0x0004047A04040400ull, 0x0008087608080800ull,
435
  magic_rook_mobility_table + 28672, magic_rook_mobility_table + 5120,
445
  0x0010106E10101000ull, 0x0020205E20202000ull, 0x0040403E40404000ull,
-
 
446
  0x0080807E80808000ull, 0x00017E0101010100ull, 0x00027C0202020200ull,
436
  magic_rook_mobility_table + 8192, magic_rook_mobility_table + 1024,
447
  0x00047A0404040400ull, 0x0008760808080800ull, 0x00106E1010101000ull,
437
  magic_rook_mobility_table + 3072, magic_rook_mobility_table + 20480,
448
  0x00205E2020202000ull, 0x00403E4040404000ull, 0x00807E8080808000ull,
438
  magic_rook_mobility_table + 23552, magic_rook_mobility_table + 65536,
449
  0x007E010101010100ull, 0x007C020202020200ull, 0x007A040404040400ull,
439
  magic_rook_mobility_table + 30720, magic_rook_mobility_table + 34816,
450
  0x0076080808080800ull, 0x006E101010101000ull, 0x005E202020202000ull,
-
 
451
  0x003E404040404000ull, 0x007E808080808000ull, 0x7E01010101010100ull,
-
 
452
  0x7C02020202020200ull, 0x7A04040404040400ull, 0x7608080808080800ull,
440
  magic_rook_mobility_table + 9216, magic_rook_mobility_table + 12288,
453
  0x6E10101010101000ull, 0x5E20202020202000ull, 0x3E40404040404000ull,
441
  magic_rook_mobility_table + 16384, magic_rook_mobility_table + 21504,
454
  0x7E80808080808000ull
442
  magic_rook_mobility_table + 59392, magic_rook_mobility_table + 67584,
455
};
443
  magic_rook_mobility_table + 71680, magic_rook_mobility_table + 35840,
456
unsigned int magic_rook_shift[64] = {
444
  magic_rook_mobility_table + 39936, magic_rook_mobility_table + 13312,
457
  52, 53, 53, 53, 53, 53, 53, 52,
445
  magic_rook_mobility_table + 17408, magic_rook_mobility_table + 54272,
458
  53, 54, 54, 54, 54, 54, 54, 53,
446
  magic_rook_mobility_table + 60416, magic_rook_mobility_table + 83968,
459
  53, 54, 54, 54, 54, 54, 54, 53,
447
  magic_rook_mobility_table + 90112, magic_rook_mobility_table + 75776,
460
  53, 54, 54, 54, 54, 54, 54, 53,
448
  magic_rook_mobility_table + 40960, magic_rook_mobility_table + 45056,
461
  53, 54, 54, 54, 54, 54, 54, 53,
449
  magic_rook_mobility_table + 49152, magic_rook_mobility_table + 55296,
462
  53, 54, 54, 54, 54, 54, 54, 53,
450
  magic_rook_mobility_table + 79872, magic_rook_mobility_table + 98304
463
  53, 54, 54, 54, 54, 54, 54, 53,
451
};
464
  53, 54, 54, 53, 53, 53, 53, 53
452
const uint64_t magic_rook[64] = {
465
};
453
  0x0080001020400080ull, 0x0040001000200040ull, 0x0080081000200080ull,
466
uint64_t mobility_mask_n[4] = {
454
  0x0080040800100080ull, 0x0080020400080080ull, 0x0080010200040080ull,
467
  0xFF818181818181FFull, 0x007E424242427E00ull,
455
  0x0080008001000200ull, 0x0080002040800100ull, 0x0000800020400080ull,
468
  0x00003C24243C0000ull, 0x0000001818000000ull
456
  0x0000400020005000ull, 0x0000801000200080ull, 0x0000800800100080ull,
469
};
457
  0x0000800400080080ull, 0x0000800200040080ull, 0x0000800100020080ull,
470
uint64_t mobility_mask_b[4] = {
458
  0x0000800040800100ull, 0x0000208000400080ull, 0x0000404000201000ull,
-
 
459
  0x0000808010002000ull, 0x0000808008001000ull, 0x0000808004000800ull,
-
 
460
  0x0000808002000400ull, 0x0000010100020004ull, 0x0000020000408104ull,
471
  0xFF818181818181FFull, 0x007E424242427E00ull,
461
  0x0000208080004000ull, 0x0000200040005000ull, 0x0000100080200080ull,
472
  0x00003C24243C0000ull, 0x0000001818000000ull
462
  0x0000080080100080ull, 0x0000040080080080ull, 0x0000020080040080ull,
473
};
463
  0x0000010080800200ull, 0x0000800080004100ull, 0x0000204000800080ull,
474
uint64_t mobility_mask_r[4] = {
464
  0x0000200040401000ull, 0x0000100080802000ull, 0x0000080080801000ull,
475
  0x8181818181818181ull, 0x4242424242424242ull,
465
  0x0000040080800800ull, 0x0000020080800400ull, 0x0000020001010004ull,
476
  0x2424242424242424ull, 0x1818181818181818ull
466
  0x0000800040800100ull, 0x0000204000808000ull, 0x0000200040008080ull,
477
};
467
  0x0000100020008080ull, 0x0000080010008080ull, 0x0000040008008080ull,
478
/*
468
  0x0000020004008080ull, 0x0000010002008080ull, 0x0000004081020004ull,
479
  values use to deal with white/black independently
469
  0x0000204000800080ull, 0x0000200040008080ull, 0x0000100020008080ull,
480
 */
470
  0x0000080010008080ull, 0x0000040008008080ull, 0x0000020004008080ull,
481
const int rankflip[2][8] = {
471
  0x0000800100020080ull, 0x0000800041000080ull, 0x00FFFCDDFCED714Aull,
482
  { RANK8, RANK7, RANK6, RANK5, RANK4, RANK3, RANK2, RANK1 },
472
  0x007FFCDDFCED714Aull, 0x003FFFCDFFD88096ull, 0x0000040810002101ull,
483
  { RANK1, RANK2, RANK3, RANK4, RANK5, RANK6, RANK7, RANK8 }
473
  0x0001000204080011ull, 0x0001000204000801ull, 0x0001000082000401ull,
484
};
474
  0x0001FFFAABFAD1A2ull
485
const int sqflip[2][64] = {
475
};
Line 488... Line 478...
488
   A6, B6, C6, D6, E6, F6, G6, H6,
478
  0x0008080808080876ull, 0x001010101010106Eull, 0x002020202020205Eull,
489
   A5, B5, C5, D5, E5, F5, G5, H5,
479
  0x004040404040403Eull, 0x008080808080807Eull, 0x0001010101017E00ull,
490
   A4, B4, C4, D4, E4, F4, G4, H4,   /* black */
480
  0x0002020202027C00ull, 0x0004040404047A00ull, 0x0008080808087600ull,
491
   A3, B3, C3, D3, E3, F3, G3, H3,
481
  0x0010101010106E00ull, 0x0020202020205E00ull, 0x0040404040403E00ull,
492
   A2, B2, C2, D2, E2, F2, G2, H2,
482
  0x0080808080807E00ull, 0x00010101017E0100ull, 0x00020202027C0200ull,
493
   A1, B1, C1, D1, E1, F1, G1, H1 },
483
  0x00040404047A0400ull, 0x0008080808760800ull, 0x00101010106E1000ull,
494
 
484
  0x00202020205E2000ull, 0x00404040403E4000ull, 0x00808080807E8000ull,
495
 { A1, B1, C1, D1, E1, F1, G1, H1,
485
  0x000101017E010100ull, 0x000202027C020200ull, 0x000404047A040400ull,
496
   A2, B2, C2, D2, E2, F2, G2, H2,
486
  0x0008080876080800ull, 0x001010106E101000ull, 0x002020205E202000ull,
497
   A3, B3, C3, D3, E3, F3, G3, H3,
487
  0x004040403E404000ull, 0x008080807E808000ull, 0x0001017E01010100ull,
498
   A4, B4, C4, D4, E4, F4, G4, H4,
488
  0x0002027C02020200ull, 0x0004047A04040400ull, 0x0008087608080800ull,
-
 
489
  0x0010106E10101000ull, 0x0020205E20202000ull, 0x0040403E40404000ull,
499
   A5, B5, C5, D5, E5, F5, G5, H5,   /* white */
490
  0x0080807E80808000ull, 0x00017E0101010100ull, 0x00027C0202020200ull,
500
   A6, B6, C6, D6, E6, F6, G6, H6,
491
  0x00047A0404040400ull, 0x0008760808080800ull, 0x00106E1010101000ull,
501
   A7, B7, C7, D7, E7, F7, G7, H7,
492
  0x00205E2020202000ull, 0x00403E4040404000ull, 0x00807E8080808000ull,
502
   A8, B8, C8, D8, E8, F8, G8, H8 }
493
  0x007E010101010100ull, 0x007C020202020200ull, 0x007A040404040400ull,
503
};
494
  0x0076080808080800ull, 0x006E101010101000ull, 0x005E202020202000ull,
504
const int sign[2] = { -1, 1 };
495
  0x003E404040404000ull, 0x007E808080808000ull, 0x7E01010101010100ull,
505
int direction[2] = { -8, 8 };
496
  0x7C02020202020200ull, 0x7A04040404040400ull, 0x7608080808080800ull,
506
int dark_corner[2] = { FILEA, FILEH };
497
  0x6E10101010101000ull, 0x5E20202020202000ull, 0x3E40404040404000ull,
507
int light_corner[2] = { FILEH, FILEA };
498
  0x7E80808080808000ull
508
int epsq[2] = { +8, -8 };
499
};
509
int rook_A[2] = { A8, A1 };
500
const unsigned magic_rook_shift[64] = {
510
int rook_D[2] = { D8, D1 };
501
  52, 53, 53, 53, 53, 53, 53, 52,
511
int rook_F[2] = { F8, F1 };
502
  53, 54, 54, 54, 54, 54, 54, 53,
512
int rook_G[2] = { G8, G1 };
503
  53, 54, 54, 54, 54, 54, 54, 53,
513
int rook_H[2] = { H8, H1 };
504
  53, 54, 54, 54, 54, 54, 54, 53,
-
 
505
  53, 54, 54, 54, 54, 54, 54, 53,
514
int pawnadv1[2] = { +8, -8 };
506
  53, 54, 54, 54, 54, 54, 54, 53,
515
int pawnadv2[2] = { +16, -16 };
507
  53, 54, 54, 54, 54, 54, 54, 53,
516
int capleft[2] = { +9, -7 };
508
  53, 54, 54, 53, 53, 53, 53, 53
-
 
509
};
-
 
510
const uint64_t mobility_mask_b[4] = {
-
 
511
  0xFF818181818181FFull, 0x007E424242427E00ull,
-
 
512
  0x00003C24243C0000ull, 0x0000001818000000ull
-
 
513
};
517
int capright[2] = { +7, -9 };
514
const uint64_t mobility_mask_r[4] = {
518
const char empty_sqs[9] = { 0, '1', '2', '3', '4', '5', '6', '7', '8' };
515
  0x8181818181818181ull, 0x4242424242424242ull,
519
/*
516
  0x2424242424242424ull, 0x1818181818181818ull
520
   This array is indexed by rook advantage and minor piece advantage.
517
};
521
   rook advantage is 4 + white rook equivalents - black rook equivalents
518
/*
522
   where a rook equivalent is number of rooks + 2 * number of queens.
519
  values use to deal with white/black independently
523
   minor piece advantage is 4 + white minors - black minors.  
520
 */
524
 
521
const int rankflip[2][8] = {
Line 530... Line 527...
530
/* M=-4  M=-3  M=-2  M=-1   M=0  M=+1  M=+2  M=+3  M=+4 */
527
  A7, B7, C7, D7, E7, F7, G7, H7,
531
  {-126, -126, -126, -126, -126, -126, -126, -126,  -42 }, /* R=-4 */
528
  A6, B6, C6, D6, E6, F6, G6, H6,
532
  {-126, -126, -126, -126, -126, -126, -126,  -42,   42 }, /* R=-3 */
529
  A5, B5, C5, D5, E5, F5, G5, H5,
533
  {-126, -126, -126, -126, -126, -126,  -42,   84,   84 }, /* R=-2 */
530
  A4, B4, C4, D4, E4, F4, G4, H4,   /* black */
534
  {-126, -126, -126, -126, -104,  -42,   84,  126,  126 }, /* R=-1 */
531
  A3, B3, C3, D3, E3, F3, G3, H3,
-
 
532
  A2, B2, C2, D2, E2, F2, G2, H2,
535
  {-126, -126, -126,  -88,    0,   88,  126,  126,  126 }, /*  R=0 */
533
  A1, B1, C1, D1, E1, F1, G1, H1},
536
  {-126, -126,  -84,   42,  104,  126,  126,  126,  126 }, /* R=+1 */
534
 
537
  { -84,  -84,   42,  126,  126,  126,  126,  126,  126 }, /* R=+2 */
535
 {A1, B1, C1, D1, E1, F1, G1, H1,
538
  { -42,   42,  126,  126,  126,  126,  126,  126,  126 }, /* R=+3 */
536
  A2, B2, C2, D2, E2, F2, G2, H2,
539
  {  42,  126,  126,  126,  126,  126,  126,  126,  126 }  /* R=+4 */
537
  A3, B3, C3, D3, E3, F3, G3, H3,
540
};
538
  A4, B4, C4, D4, E4, F4, G4, H4,
541
int pp_dist_bonus[8] = { 0, 0, 0, 2, 7, 19, 31, 0 };
539
  A5, B5, C5, D5, E5, F5, G5, H5,   /* white */
542
int king_tropism_n[8] = { 0, 3, 3, 2, 1, 0, 0, 0 };
540
  A6, B6, C6, D6, E6, F6, G6, H6,
543
int king_tropism_b[8] = { 0, 2, 2, 1, 0, 0, 0, 0 };
541
  A7, B7, C7, D7, E7, F7, G7, H7,
544
int king_tropism_r[8] = { 0, 4, 3, 2, 1, 1, 1, 1 };
542
  A8, B8, C8, D8, E8, F8, G8, H8}
545
int king_tropism_q[8] = { 0, 6, 5, 4, 3, 2, 2, 2 };
543
};
546
int passed_pawn_value[2][8] = {
544
const int rank1[2] = {RANK8, RANK1};
547
  { 0, 6, 6, 30, 70, 120, 200, 0 },              /* [mg][8] */
545
const int rank2[2] = {RANK7, RANK2};
548
  { 0, 7, 7, 33, 77, 132, 220, 0 }               /* [eg][8] */
546
const int rank3[2] = {RANK6, RANK3};
549
};
547
const int rank4[2] = {RANK5, RANK4};
550
int passed_pawn_connected[2][8] = {
548
const int rank5[2] = {RANK4, RANK5};
551
  { 0, 1, 1, 3,  7, 12, 20, 0 },                 /* [mg][8] */
549
const int rank6[2] = {RANK3, RANK6};
552
  { 0, 2, 2, 9, 21, 36, 60, 0 }                  /* [eg][8] */
550
const int rank7[2] = {RANK2, RANK7};
553
};
551
const int rank8[2] = {RANK1, RANK8};
554
int rook_behind_passed_pawn[2][8] = {
552
const int epdir[2] = {8, -8};
555
  { 0, 1, 1, 3,  7, 12, 20, 0 },                 /* [mg][8] */
553
const int csq[2] = {C8, C1};
556
  { 0, 2, 2, 9, 21, 36, 60, 0 }                  /* [eg][8] */
554
const int dsq[2] = {D8, D1};
557
};
555
const int esq[2] = {E8, E1};
558
int passed_pawn_blockaded_by_enemy[2][8] = {
556
const int fsq[2] = {F8, F1};
559
  { 0, 3, 3, 14, 33, 57, 95, 0 },                /* [mg][8] */
557
const int gsq[2] = {G8, G1};
560
  { 0, 2, 2, 11, 25, 42, 70, 0 }                 /* [eg][8] */
558
uint64_t distance_ring[64][8];
561
};
559
const int sign[2] = {-1, 1};
562
int passed_pawn_blockaded_by_friendly[2][8] = {
-
 
563
  { 0, 1, 1, 7, 16, 27, 45, 0 },                 /* [mg][8] */
560
const int epsq[2] = {+8, -8};
564
  { 0, 1, 1, 3,  7, 12, 20, 0 }                  /* [eg][8] */
561
const int rook_A[2] = {A8, A1};
565
};
562
const int rook_D[2] = {D8, D1};
566
int passed_pawn_obstructed[8] = { 0, 1, 1, 4, 9, 15, 25, 0 };
563
const int rook_F[2] = {F8, F1};
567
int passed_pawn_far_away[8] = { 0, 1, 1, 6, 14, 24, 40, 0 };
564
const int rook_G[2] = {G8, G1};
568
int passed_pawn_not_far_away[8] = { 0, 1, 1, 4, 9, 15, 25, 0 };
565
const int rook_H[2] = {H8, H1};
569
int passed_pawn_candidate[2][8] = {
566
const int pawnadv1[2] = {+8, -8};
570
  { 0,  4,  4,  8, 16, 36,  0, 0 },         /* [mg][rank] */
567
const int pawnadv2[2] = {+16, -16};
571
  { 0,  9,  9, 16, 32, 48,  0, 0 }          /* [eg][rank] */
568
const int capleft[2] = {+9, -7};
572
};
569
const int capright[2] = {+7, -9};
573
int passed_pawn_hidden[2] = { 0, 40 };
570
const char empty_sqs[9] = {0, '1', '2', '3', '4', '5', '6', '7', '8'};
574
int doubled_pawn_value[2] = { 5, 6 };
571
const int pcval[7] = {0, 100, 300, 300, 500, 900, 9900};
575
int outside_passed[2] = { 20, 60 };
572
const int p_vals[7] = {0, 1, 3, 3, 5, 9, 99};
576
int pawn_defects[2][8] = {
573
const int MVV_LVA[7][7] = {
577
  { 0, 0, 0, 1, 2, 3, 0, 0 },               /* [black][8] */
574
    {0,  5<<21,  4<<21,  4<<21,  3<<21,  2<<21,  1<<21},
578
  { 0, 0, 3, 2, 1, 0, 0, 0 }                /* [white][8] */
575
    {0, 10<<21,  9<<21,  9<<21,  8<<21,  7<<21,  6<<21},
579
};
576
    {0, 15<<21, 14<<21, 14<<21, 13<<21, 12<<21, 11<<21},
580
const char square_color[64] = {
577
    {0, 15<<21, 14<<21, 14<<21, 13<<21, 12<<21, 11<<21},
581
  1, 0, 1, 0, 1, 0, 1, 0,
578
    {0, 20<<21, 19<<21, 19<<21, 18<<21, 17<<21, 16<<21},
582
  0, 1, 0, 1, 0, 1, 0, 1,
579
    {0, 25<<21, 24<<21, 24<<21, 23<<21, 22<<21, 21<<21},
583
  1, 0, 1, 0, 1, 0, 1, 0,
580
    {0, 30<<21, 29<<21, 29<<21, 28<<21, 27<<21, 26<<21}};
-
 
581
const int pieces[2][7] = {
-
 
582
  {0, -1, -2, -3, -4, -5, -6},
-
 
583
  {0, +1, +2, +3, +4, +5, +6}
-
 
584
};
-
 
585
const int lower_n = 16;
-
 
586
const int lower_b = 10;
-
 
587
const int mobility_score_n[4] = {1, 2, 3, 4};
-
 
588
const int mobility_score_b[4] = {1, 2, 3, 4};
-
 
589
const int mobility_score_r[4] = {1, 2, 3, 4};
-
 
590
const int mob_curve_r[48] = {
-
 
591
  -27,-23,-21,-19,-15,-10, -9, -8,
-
 
592
   -7, -6, -5, -4, -3, -2, -1,  0,
-
 
593
    1,  2,  3,  4,  5,  6,  7,  8,
-
 
594
    9, 10, 11, 12, 13, 14, 15, 16,
-
 
595
   17, 18, 19, 20, 21, 22, 23, 24,
-
 
596
   25, 26, 27, 28, 29, 30, 31, 32
-
 
597
};
584
  0, 1, 0, 1, 0, 1, 0, 1,
598
int piece_values[2][7] = {
585
  1, 0, 1, 0, 1, 0, 1, 0,
599
  {0, -PAWN_VALUE, -KNIGHT_VALUE, -BISHOP_VALUE,
-
 
600
      -ROOK_VALUE, -QUEEN_VALUE,    -KING_VALUE},
586
  0, 1, 0, 1, 0, 1, 0, 1,
601
  {0,  PAWN_VALUE,  KNIGHT_VALUE,  BISHOP_VALUE,
-
 
602
       ROOK_VALUE,  QUEEN_VALUE,     KING_VALUE}
-
 
603
};
-
 
604
/*
587
  1, 0, 1, 0, 1, 0, 1, 0,
605
   First term is a character string explaining what the eval
588
  0, 1, 0, 1, 0, 1, 0, 1
606
   term is used for.
589
};
607
 
590
const char b_n_mate_dark_squares[64] = {
608
  Second term is the "type" of the value.
591
  99, 90, 80, 70, 60, 50, 40, 30,
609
     0 = heading entry (no values, just a category name to display).
592
  90, 80, 70, 60, 50, 40, 30, 40,
610
     1 = scalar value.
593
  80, 70, 60, 50, 40, 30, 40, 50,
611
     2 = array[mg]
594
  70, 60, 50, 40, 30, 40, 50, 60,
612
     3 = floating point value
595
  60, 50, 40, 30, 40, 50, 60, 70,
613
 
596
  50, 40, 30, 40, 50, 60, 70, 80,
614
   Third term is the "size" of the scoring term, where 0 is a
597
  40, 30, 40, 50, 60, 70, 80, 90,
615
     scalar value, otherwise it is the actual number of elements in
598
  30, 40, 50, 60, 70, 80, 90, 99
616
     an array of values.
599
};
617
 
600
const char b_n_mate_light_squares[64] = {
618
   Fourth term is a pointer to the data value(s).
601
  30, 40, 50, 60, 70, 80, 90, 99,
619
*/
602
  40, 30, 40, 50, 60, 70, 80, 90,
620
struct personality_term personality_packet[256] = {
603
  50, 40, 30, 40, 50, 60, 70, 80,
621
  {"search options                          ", 0, 0, NULL},        /*  0 */
604
  60, 50, 40, 30, 40, 50, 60, 70,
622
  {"check extension                         ", 1, 0, &check_depth},
-
 
623
  {"null-move reduction                     ", 1, 0, &null_depth},
-
 
624
  {"null-move adaptive divisor              ", 1, 0, &null_divisor},
-
 
625
  {"LMR min distance to frontier            ", 1, 0, &LMR_rdepth},
-
 
626
  {"LMR min reduction                       ", 1, 0, &LMR_min},
-
 
627
  {"LMR max reduction                       ", 1, 0, &LMR_max},
-
 
628
  {"LMR formula depth bias                  ", 3, 0, &LMR_db},
-
 
629
  {"LMR formula moves searched bias         ", 3, 0, &LMR_mb},
-
 
630
  {"LMR scale factor                        ", 3, 0, &LMR_s},
-
 
631
  {"search options (continued)              ", 0, 0, NULL},        /* 10 */
-
 
632
  {"prune depth                             ", 1, 0, &pruning_depth},
-
 
633
  {"prune margin [remain_depth]             ", 4, 8, pruning_margin},
-
 
634
  {NULL, 0, 0, NULL},
-
 
635
  {NULL, 0, 0, NULL},
-
 
636
  {NULL, 0, 0, NULL},
-
 
637
  {NULL, 0, 0, NULL},
-
 
638
  {NULL, 0, 0, NULL},
605
  70, 60, 50, 40, 30, 40, 50, 60,
639
  {NULL, 0, 0, NULL},
606
  80, 70, 60, 50, 40, 30, 40, 50,
640
  {NULL, 0, 0, NULL},
607
  90, 80, 70, 60, 50, 40, 30, 40,
641
};
608
  99, 90, 80, 70, 60, 50, 40, 30
642
/* *INDENT-ON* */
609
};
643
 
610
const int mate[64] = {
644
611
  200, 180, 160, 140, 140, 160, 180, 200,
645
612
  180, 160, 140, 120, 120, 140, 160, 180,
646
613
  160, 140, 120, 100, 100, 120, 140, 160,
647
614
  140, 120, 100, 100, 100, 100, 120, 140,
648
615
  140, 120, 100, 100, 100, 100, 120, 140,
649
616
  160, 140, 120, 100, 100, 120, 140, 160,
-
 
617
  180, 160, 140, 120, 120, 140, 160, 180,
650
618
  200, 180, 160, 140, 140, 160, 180, 200
651
619
};
652
620
int knight_outpost[2][64] = {
653
621
  { 0, 0, 0, 0, 0, 0, 0, 0,
654
622
    0, 0, 0, 0, 0, 0, 0, 0,
655
623
    0, 1, 4, 4, 4, 4, 1, 0,
656
Line 630... Line 663...
630
  { 0, 0, 0, 0, 0, 0, 0, 0,
663
631
    0, 0, 0, 0, 0, 0, 0, 0,
664
632
    0, 0, 0, 0, 0, 0, 0, 0,
665
633
    0, 1, 4, 4, 4, 4, 1, 0,
666
634
    0, 2, 6, 8, 8, 6, 2, 0,   /* [white][64] */
667
635
    0, 1, 4, 4, 4, 4, 1, 0,
668
636
    0, 0, 0, 0, 0, 0, 0, 0,
669
637
    0, 0, 0, 0, 0, 0, 0, 0 }
670
638
};
671
639
int bishop_outpost[2][64] = {
672
-
 
673
-
 
674
-
 
675
640
  { 0, 0, 0, 0, 0, 0, 0, 0,
676
641
   -1, 0, 0, 0, 0, 0, 0,-1,
677
642
    0, 0, 1, 1, 1, 1, 0, 0,
678
643
    0, 1, 3, 3, 3, 3, 1, 0,
679
644
    0, 3, 5, 5, 5, 5, 3, 0,   /* [black][64] */
680
645
    0, 1, 2, 2, 2, 2, 1, 0,
-
 
646
    0, 0, 0, 0, 0, 0, 0, 0,
681
647
    0, 0, 0, 0, 0, 0, 0, 0 },
682
648
 
683
649
  { 0, 0, 0, 0, 0, 0, 0, 0,
684
650
    0, 0, 0, 0, 0, 0, 0, 0,
685
651
    0, 1, 2, 2, 2, 2, 1, 0,
686
Line 665... Line 700...
665
    -10,   0,   0, -12, -12,   0,   0, -10,
700
666
      0,   0,   0,   0,   0,   0,   0,   0 },
701
667
 
702
668
    { 0,   0,   0,   0,   0,   0,   0,   0,
703
669
    -10,   0,   0, -12, -12,   0,   0, -10,
704
670
     -9,   1,   1,  10,  10,   1,   1,  -9,
705
671
     -7,   3,   3,  13,  13,   3,   3,  -7,
706
672
     -4,   6,   6,  16,  16,   6,   6,  -4,   /* [mg][white][64] */
707
673
      0,  10,  10,  30,  30,  10,  10,   0,
708
674
     56,  66,  66,  66,  66,  66,  66,  56,
709
675
      0,   0,   0,   0,   0,   0,   0,   0 }},
710
Line 689... Line 724...
689
     -7,   3,   3,  13,  13,   3,   3,  -7,
724
690
     -4,   6,   6,  16,  16,   6,   6,  -4,   /* [eg][white][64] */
725
691
      0,  10,  10,  30,  30,  10,  10,   0,
726
692
     56,  66,  66,  66,  66,  66,  66,  56,
727
693
      0,   0,   0,   0,   0,   0,   0,   0 }}
728
694
};
729
695
int nval[2][2][64] = {
730
696
  {{-29, -19, -19,  -9,  -9, -19, -19, -29,
731
697
      1,  12,  18,  22,  22,  18,  12,   1,
732
698
      1,  14,  23,  27,  27,  23,  14,   1,
733
699
      1,  14,  23,  28,  28,  23,  14,   1,
734
Line 839... Line 874...
839
    -60, -40, -20,  20,  60,  60,  60,  40,
874
840
    -60, -40, -20,  20,  40,  40,  40,  40,
875
841
    -60, -40, -20, -20, -20, -20, -20, -20 }
876
842
};
877
843
int kval_q[2][64] = {
878
844
   {-20, -20, -20, -20, -20, -20, -40, -60,
879
845
     40,  40,  40,  40,  20, -20, -40, -60,
880
846
     40,  60,  60,  60,  20, -20, -40, -60,
881
847
     40,  60,  60,  60,  20, -20, -40, -60,
882
848
     40,  40,  40,  40,  20, -20, -40, -60,   /* [black][64] */
883
849
     20,  20,  20,  20,  20, -20, -40, -60,
884
Line 863... Line 898...
863
   0,  7, 14, 21, 28, 35, 42,  49,
898
864
  56, 63, 70, 77, 84, 91, 98, 105
899
865
};
900
866
int tropism_vector[16] = {
901
867
   0,  1,  2,  3,   4,   5,  11,  20,
902
868
  32, 47, 65, 86, 110, 137, 167, 200
903
869
};
904
870
const int p_values[13] = { 10000, 900, 500, 300, 300, 100, 0,
905
871
  100, 300, 300, 500, 900, 9900
906
872
};
907
873
const int pcval[7] = { 0, 100, 300, 300, 500, 900, 9900 };
908
Line 887... Line 922...
887
int pawn_connected[2] = { 4, 8 };
922
888
int pawn_isolated[2] = { 18, 21 };
923
889
int pawn_weak[2] = { 8, 18 };
924
890
int lower_n = 16;
925
891
int mobility_score_n[4] = { 1, 2, 3, 4 };
926
892
int lower_b = 10;
927
893
int bishop_trapped = 174;
928
894
int bishop_with_wing_pawns[2] = { 18, 36 };
929
895
int bishop_pair[2] = { 38, 56 };
930
896
int mobility_score_b[4] = { 1, 2, 3, 4 };
931
897
int mobility_score_r[4] = { 1, 2, 3, 4 };
932
898
int rook_on_7th[2] = { 25, 35 };
933
899
int rook_open_file[2] = { 35, 20 };
934
900
int rook_half_open_file[2] = { 10, 10 };
935
901
int rook_trapped = 60;
936
902
int open_file[8] = { 6, 5, 4, 4, 4, 4, 5, 6 };
937
903
int half_open_file[8] = { 4, 4, 3, 3, 3, 3, 4, 4 };
938
904
int king_safety_mate_threat = 600;
939
905
int king_king_tropism = 10;
940
906
int development_thematic = 12;
-
 
907
int development_losing_castle = 20;
-
 
908
int development_not_castled = 20;
-
 
909
/*
-
 
910
   First term is a character string explaining what the eval
941
911
   term is used for.
942
912
 
943
913
  Second term is the "type" of the value.  
944
914
     0 = heading entry (no values, just a category name to display).
945
915
     1 = scalar value.
946
916
     2 = array[mg]
947
917
     3 = array[mg][side][64].  These values are displayed as 8x8
948
918
       boards with white values at the bottom, and the ranks/files
949
919
       labeled to make them easier to read.
950
920
     4 = array[side][64]
951
921
     5 = array[rank]
952
922
     6 = array[mg][8]
953
923
 
954
924
   Third term is the "size" of the scoring term, where 0 is a
955
925
     scalar value, otherwise it is the actual number of elements in
956
926
     an array of values.
957
927
 
958
928
   Fourth term is a pointer to the data value(s).
959
929
*/
960
930
struct personality_term personality_packet[256] = {
961
931
  {"search options                       ", 0, 0, NULL},        /* 0 */
962
932
  {"check extension                      ", 1, 0, &check_depth},
963
933
  {"null-move reduction                  ", 1, 0, &null_depth},
964
934
  {"LMR min distance to frontier         ", 1, 0, &LMR_remaining_depth},
965
935
  {"LMR min reduction                    ", 1, 0, &LMR_min_reduction},
966
936
  {"LMR max reduction                    ", 1, 0, &LMR_max_reduction},
967
937
  {"prune depth                          ", 1, 0, &pruning_depth},
968
938
  {"prune margin [remain_depth]          ", 5, 8, pruning_margin},
969
939
  {NULL, 0, 0, NULL},
970
-
 
971
-
 
972
-
 
973
-
 
974
-
 
975
-
 
976
-
 
977
-
 
978
-
 
979
940
  {NULL, 0, 0, NULL},
980
941
  {"raw piece values                     ", 0, 0, NULL},        /* 10 */
981
942
  {"pawn value                           ", 2, 2, piece_values[pawn]},
982
943
  {"knight value                         ", 2, 2, piece_values[knight]},
983
-
 
984
-
 
985
-
 
986
944
  {"bishop value                         ", 2, 2, piece_values[bishop]},
987
945
  {"rook value                           ", 2, 2, piece_values[rook]},
988
946
  {"queen value                          ", 2, 2, piece_values[queen]},
989
947
  {NULL, 0, 0, NULL},
990
948
  {NULL, 0, 0, NULL},
991
949
  {NULL, 0, 0, NULL},
992
950
  {NULL, 0, 0, NULL},
993
951
  {"miscellaneous scoring values         ", 0, 0, NULL},        /* 20 */
994
952
  {"wtm bonus                            ", 2, 2, wtm_bonus},
995
953
  {"draw score                           ", 1, 0, &abs_draw_score},
996
954
#if defined(SKILL)
997
955
  {"skill level setting                  ", 1, 0, &skill},
-
 
956
#else
-
 
957
  {NULL, 0, 0, NULL},
-
 
958
#endif
-
 
959
  {NULL, 0, 0, NULL},
998
960
  {NULL, 0, 0, NULL},
-
 
961
  {NULL, 0, 0, NULL},
-
 
962
  {NULL, 0, 0, NULL},
-
 
963
  {NULL, 0, 0, NULL},
999
964
  {NULL, 0, 0, NULL},
-
 
965
  {"pawn evaluation                      ", 0, 0, NULL},        /* 30 */
1000
966
  {"pawn piece/square table (white)      ", 3, 256, (int *) pval},
1001
967
  {"pawn connected                       ", 2, 2, pawn_connected},
1002
968
  {"pawn isolated                        ", 2, 2, pawn_isolated},
1003
969
  {"pawn weak                            ", 2, 2, pawn_weak},
1004
970
  {"outside passed pawn                  ", 2, 2, outside_passed},
1005
971
  {"hidden passed pawn                   ", 2, 2, passed_pawn_hidden},
1006
972
  {"doubled pawn                         ", 2, 2, doubled_pawn_value},
1007
973
  {"candidate passed pawn [rank]         ", 6, 16, (int *) passed_pawn_candidate},
1008
974
  {"passed pawn [rank]                   ", 6, 16, (int *) passed_pawn_value},
1009
975
  {"passed pawn blocked by enemy [rank]  ", 6, 16, (int *) passed_pawn_blockaded_by_enemy},
1010
976
  {"passed pawn blocked by friend [rank] ", 6, 16, (int *) passed_pawn_blockaded_by_friendly},
1011
977
  {"passed pawn connected [rank]         ", 6, 16, (int *) passed_pawn_connected},
-
 
978
  {"passed pawn obstructed [rank]        ", 5, 8, (int *) passed_pawn_obstructed},
-
 
979
  {"passed pawn far away [rank]          ", 5, 8, (int *) passed_pawn_far_away},
-
 
980
  {"passed pawn not far away [rank]      ", 5, 8, (int *) passed_pawn_not_far_away},
-
 
981
  {"pawn can promote                     ", 1, 0, &pawn_can_promote},
-
 
982
  {NULL, 0, 0, NULL},
1012
983
  {NULL, 0, 0, NULL},
-
 
984
  {NULL, 0, 0, NULL},
-
 
985
  {"knight scoring                       ", 0, 0, NULL},        /* 50 */
-
 
986
  {"knight piece/square table (white)    ", 3, 256, (int *) nval},
-
 
987
  {"knight outpost [square]              ", 4, 128, (int *) knight_outpost},
-
 
988
  {"knight king tropism [distance]       ", 5, 8, king_tropism_n},
-
 
989
  {"knight mobility                      ", 5, 4, mobility_score_n},
-
 
990
  {NULL, 0, 0, NULL},
1013
991
  {NULL, 0, 0, NULL},
-
 
992
  {NULL, 0, 0, NULL},
-
 
993
  {NULL, 0, 0, NULL},
-
 
994
  {NULL, 0, 0, NULL},
-
 
995
  {"bishop scoring                       ", 0, 0, NULL},        /* 60 */
-
 
996
  {"bishop piece/square table (white)    ", 3, 256, (int *) bval},
-
 
997
  {"bishop king tropism [distance]       ", 5, 8, king_tropism_b},
-
 
998
  {"bishop mobility/square table         ", 5, 4, mobility_score_b},
-
 
999
  {"bishop outpost [square]              ", 4, 128, (int *) bishop_outpost},
-
 
1000
  {"bishop with wing pawns               ", 2, 2, bishop_with_wing_pawns},
-
 
1001
  {"bishop pair                          ", 2, 2, bishop_pair},
-
 
1002
  {"bishop trapped                       ", 1, 0, &bishop_trapped},
-
 
1003
  {NULL, 0, 0, NULL},
-
 
1004
  {NULL, 0, 0, NULL},
-
 
1005
  {"rook scoring                         ", 0, 0, NULL},        /* 70 */
-
 
1006
  {"rook half open file                  ", 2, 2, rook_half_open_file},
-
 
1007
  {"rook open file                       ", 2, 2, rook_open_file},
-
 
1008
  {"rook king tropism [distance]         ", 5, 8, king_tropism_r},
-
 
1009
  {"rook mobility/square table           ", 5, 4, mobility_score_r},
1014
1010
  {"rook on 7th                          ", 2, 2, rook_on_7th},
1015
1011
  {"rook behind passed pawn              ", 6, 16, &rook_behind_passed_pawn[0][0]},
1016
1012
  {"rook trapped                         ", 1, 0, &rook_trapped},
-
 
1013
  {NULL, 0, 0, NULL},
-
 
1014
  {NULL, 0, 0, NULL},
-
 
1015
  {"queen scoring                        ", 0, 0, NULL},        /* 80 */
-
 
1016
  {"queen piece/square table (white)     ", 3, 256, (int *) qval},
-
 
1017
  {"queen king tropism [distance]        ", 5, 8, king_tropism_q},
-
 
1018
  {NULL, 0, 0, NULL},
-
 
1019
  {NULL, 0, 0, NULL},
-
 
1020
  {NULL, 0, 0, NULL},
-
 
1021
  {NULL, 0, 0, NULL},
-
 
1022
  {NULL, 0, 0, NULL},
-
 
1023
  {NULL, 0, 0, NULL},
-
 
1024
  {NULL, 0, 0, NULL},
-
 
1025
  {"king scoring                         ", 0, 0, NULL},        /* 90 */
-
 
1026
  {"king piece/square normal             ", 4, 128, (int *)kval_n},
-
 
1027
  {"king piece/square kside pawns        ", 4, 128, (int *)kval_k},
-
 
1028
  {"king piece/square qside pawns        ", 4, 128, (int *)kval_q},
-
 
1029
  {"king safety pawn-shield vector       ", 6, 16, safety_vector},
-
 
1030
  {"king safety tropism vector           ", 6, 16, tropism_vector},
-
 
1031
  {"king safe open file [file]           ", 5, 8, open_file},
-
 
1032
  {"king safe half-open file [file]      ", 5, 8, half_open_file},
-
 
1033
  {"king king tropism (endgame)          ", 1, 0, &king_king_tropism},
-
 
1034
  {NULL, 0, 0, NULL},
-
 
1035
  {"development scoring                  ", 0, 0, NULL},        /* 100 */
-
 
1036
  {"development thematic                 ", 1, 0, &development_thematic},
-
 
1037
  {"development losing castle rights     ", 1, 0, &development_losing_castle},
-
 
1038
  {"development not castled              ", 1, 0, &development_not_castled},
-
 
1039
};
-
 
1040
/* *INDENT-ON* */
-
 
1041
 
-
 
1042
-
 
1043
-
 
1044
-
 
1045
-
 
1046
1017
1047
-
 
1048
-
 
1049
-
 
1050
-
 
1051
-
 
1052
-
 
1053
1018
1054
-
 
1055
-
 
1056
-
 
1057
-
 
1058
-
 
1059
1019
1060
1020
1061
-
 
1062
-
 
1063
-
 
1064
-
 
1065
-
 
1066
-
 
1067
-
 
1068
-
 
1069
-
 
1070
-
 
1071
-
 
1072
-
 
1073
-
 
1074
-
 
1075
-
 
1076
-
 
1077
-
 
1078
1021
1079
-
 
1080
-
 
1081
1022
1082
-
 
1083
-
 
1084
-
 
1085
-
 
1086
-
 
1087
1023
1088
-
 
1089
-
 
1090
-
 
1091
-
 
1092
-
 
1093
-
 
1094
-
 
1095
-
 
1096
-
 
1097
-
 
1098
-
 
1099
-
 
1100
-
 
1101
-
 
1102
-
 
1103
-
 
1104
-
 
1105
-
 
1106
-
 
1107
-
 
1108
-
 
1109
-
 
1110
-
 
1111
-
 
1112
-
 
1113
-
 
1114
-
 
1115
-
 
1116
-
 
1117
-
 
1118
-
 
1119
-
 
1120
-
 
1121
-
 
1122
-
 
1123
-
 
1124
-
 
1125
-
 
1126
-
 
1127
-
 
1128
-
 
1129
-
 
1130
-
 
1131
-
 
1132
-
 
1133
-
 
1134
-
 
1135
-
 
1136
-
 
1137
-
 
1138
-
 
1139
-
 
1140
-
 
1141
-
 
1142
-
 
1143
-
 
1144
-
 
1145
-
 
1146
-
 
1147
-
 
1148
-
 
1149
-
 
1150
-
 
1151
-
 
1152
-
 
1153
-
 
1154
-
 
1155
-
 
1156
-
 
1157
-
 
1158
-
 
1159
-
 
1160
-
 
1161
-
 
1162
-
 
1163
-
 
1164
-
 
1165
-
 
1166
-
 
1167
-
 
1168
-
 
1169
-
 
1170
-
 
1171
-
 
1172
-
 
1173
-
 
1174
-
 
1175
-
 
1176
-
 
1177
-
 
1178
-
 
1179
-
 
1180
-
 
1181
-
 
1182
-
 
1183
-
 
1184
-
 
1185
-
 
1186
-
 
1187
-
 
1188
-
 
1189
-
 
1190
-
 
1191
-
 
1192
-
 
1193
-
 
1194
-
 
1195
-
 
1196
-
 
1197
-
 
1198
-
 
1199
-
 
1200
-
 
1201
-
 
1202
-
 
1203
-
 
1204
-
 
1205
-
 
1206
-
 
1207
-
 
1208
-
 
1209
-
 
1210
-
 
1211
-
 
1212
-
 
1213
-
 
1214
-
 
1215
-
 
1216
-
 
1217
-
 
1218
-
 
1219
-
 
1220
-
 
1221
-
 
1222
-
 
1223
-
 
1224
-
 
1225
-
 
1226
-
 
1227
-
 
1228
-
 
1229
-
 
1230
-
 
1231
-
 
1232
-
 
1233
-
 
1234
-
 
1235
-
 
1236
-
 
1237
-
 
1238
-
 
1239
-
 
1240
-
 
1241
-
 
1242
-
 
1243
-
 
1244
-
 
1245
-
 
1246
-
 
1247
-
 
1248
-
 
1249
-
 
1250
-
 
1251
-
 
1252
-
 
1253
-
 
1254
-
 
1255
-
 
1256
-
 
1257
-
 
1258
-
 
1259
-
 
1260
-
 
1261
-
 
1262
-
 
1263
-
 
1264
-
 
1265
-
 
1266
-
 
1267
-
 
1268
-
 
1269
-
 
1270
-
 
1271
-
 
1272
-
 
1273
-
 
1274
-
 
1275
-
 
1276
-
 
1277
-
 
1278
-
 
1279
-
 
1280
-
 
1281
-
 
1282
-
 
1283
-
 
1284
-
 
1285
-
 
1286
-
 
1287
-
 
1288
-
 
1289
-
 
1290
-
 
1291
-
 
1292
-
 
1293
-
 
1294
-
 
1295
-
 
1296
-
 
1297
-
 
1298
-
 
1299
-
 
1300
-
 
1301
-
 
1302
-
 
1303
-
 
1304
-
 
1305
-
 
1306
-
 
1307
-
 
1308
-
 
1309
-
 
1310
-
 
1311
-
 
1312
-
 
1313
-
 
1314
1024
1315
1025
1316
1026
1317
1027
-
 
1028
1318
1029
1319
1030
1320
-
 
1321
-
 
1322
-
 
1323
-
 
1324
-
 
1325
-
 
1326
-
 
1327
-
 
1328
-
 
1329
-
 
1330
-
 
1331
-
 
1332
-
 
1333
-
 
1334
-
 
1335
-
 
1336
-
 
1337
-
 
1338
-
 
1339
-
 
1340
-
 
1341
-
 
1342
-
 
1343
-
 
1344
-
 
1345
1031
1346
1032
1347
1033
1348
1034
1349
1035
1350
1036
1351
1037
1352
1038
1353
-
 
1354
-
 
1355
-
 
1356
1039
1357
-
 
1358
-
 
1359
1040
1360
1041
1361
1042
1362
1043
1363
1044
1364
1045
1365
1046
1366
1047
1367
1048
1368
1049
1369
1050
1370
1051
1371
1052
1372
1053
1373
1054
1374
-
 
1375
-
 
1376
-
 
1377
-
 
1378
-
 
1379
-
 
1380
-
 
1381
-
 
1382
-
 
1383
-
 
1384
-
 
1385
-
 
1386
-
 
1387
-
 
1388
1055
1389
-
 
1390
-
 
1391
1056
1392
-
 
1393
-
 
1394
-
 
1395
-
 
1396
-
 
1397
-
 
1398
-
 
1399
-
 
1400
-
 
1401
-
 
1402
-
 
1403
-
 
1404
-
 
1405
1057
1406
-
 
1407
-
 
1408
-
 
1409
-
 
1410
-
 
1411
-
 
1412
-
 
1413
-
 
1414
-
 
1415
-
 
1416
-
 
1417
-
 
1418
-
 
1419
-
 
1420
-
 
1421
-
 
1422
-
 
1423
-
 
1424
-
 
1425
-
 
1426
-
 
1427
-
 
1428
-
 
1429
-
 
1430
-
 
1431
-
 
1432
-
 
1433
-
 
1434
-
 
1435
-
 
1436
-
 
1437
-
 
1438
-
 
1439
-
 
1440
-
 
1441
1058
1442
-
 
1443
-
 
1444
-
 
1445
-
 
1446
1059
1447
-
 
1448
1060
1449
-
 
1450
-
 
1451
-
 
1452
-
 
1453
-
 
1454
-
 
1455
1061
1456
1062
1457
1063
1458
1064
1459
1065
1460
1066
1461
-
 
1462
-
 
1463
-
 
1464
-
 
1465
-
 
1466
-
 
1467
-
 
1468
-
 
1469
-
 
1470
1067
1471
-
 
1472
-
 
1473
-
 
1474
-
 
1475
1068
1476
1069