- #include "chess.h" 
- /* *INDENT-OFF* */#if !defined(INLINEASM) 
- unsigned char msb[65536]; 
- unsigned char lsb[65536]; 
- #endif 
- unsigned char msb_8bit[256]; 
- unsigned char lsb_8bit[256]; 
- unsigned char pop_cnt_8bit[256]; 
- uint64_t mask_pawn_connected[2][64]; 
- uint64_t mask_pawn_isolated[64]; 
- uint64_t mask_passed[2][64]; 
- uint64_t mask_pattacks[2][64]; 
- uint64_t pawn_race[2][2][64]; 
- BOOK_POSITION book_buffer[BOOK_CLUSTER_SIZE]; 
- BOOK_POSITION book_buffer_char[BOOK_CLUSTER_SIZE]; 
- const int OOsqs[2][3] =  {{E8, F8, G8}, {E1, F1, G1}}; 
- const int OOOsqs[2][3] = {{E8, D8, C8}, {E1, D1, C1}}; 
- const int OOfrom[2] = {E8, E1}; 
- const int OOto[2] =   {G8, G1}; 
- const int OOOto[2] =  {C8, C1}; 
- #define VERSION      "25.0.1" 
- char version[8] = {VERSION}; 
- PLAYING_MODE mode = normal_mode; 
- int batch_mode = 0;                  /* no asynch reads */ 
- int swindle_mode = 1;                /* try to swindle */ 
- int call_flag = 0; 
- int crafty_rating = 2500; 
- int opponent_rating = 2500; 
- int last_search_value = 0; 
- int pruning_margin[10] = {0, 100, 150, 200, 250, 300, 400, 500, 600, 700}; 
- int pruning_depth = 7; 
- int movecnt_pruning[4] = {0, 12, 15, 18}; 
- int movecnt_depth = 3; 
- int pgn_suggested_percent = 0; 
- char pgn_event[128] = {"?"}; 
- char pgn_site[128] = {"?"}; 
- char pgn_date[128] = {"????.??.??"}; 
- char pgn_round[128] = {"?"}; 
- char pgn_white[128] = {"unknown"}; 
- char pgn_white_elo[128] = {""}; 
- char pgn_black[128] = {"Crafty " VERSION}; 
- char pgn_black_elo[128] = {""}; 
- char pgn_result[128] = {"*"}; 
- char *B_list[128]; 
- char *AK_list[128]; 
- char *GM_list[128]; 
- char *IM_list[128]; 
- char *SP_list[128]; 
- char *SP_opening_filename[128]; 
- char *SP_personality_filename[128]; 
- int output_format = 0; 
- #if !defined(NOEGTB) 
- int EGTBlimit = 0; 
- int EGTB_use = 0; 
- int EGTB_draw = 0; 
- int EGTB_depth = 6; 
- size_t EGTB_cache_size = 4096 * 4096; 
- void *EGTB_cache = (void *) 0; 
- int EGTB_setup = 0; 
- #endif 
- int xboard = 0; 
- int xboard_done = 0; 
- int pong = 0; 
- int early_exit = 99; 
- int new_game = 0; 
- char book_path[128] = {BOOKDIR}; 
- char log_path[128] = {LOGDIR}; 
- char tb_path[128] = {TBDIR}; 
- char rc_path[128] = {RCDIR}; 
- int initialized = 0; 
- int kibitz = 0; 
- int post = 0; 
- int log_id = 0; 
- int game_wtm = 1; 
- int last_opponent_move = 0; 
- int check_depth = 1;                  /* extend checks one ply                */ 
- int null_depth = 3;                   /* R=3 + (next line)                    */ 
- int null_divisor = 6;                 /* R = null_depth + depth / 6           */ 
- int LMR_rdepth = 1;                   /* leave 1 full ply after reductions    */ 
- int LMR_min= 1;                       /* minimum reduction 1 ply              */ 
- int LMR_max= 15;                      /* maximum reduction 15 plies           */ 
- double LMR_db = 1.8;                  /* depth is 1.8x as important as        */ 
- double LMR_mb = 1.0;                  /* moves searched in the formula.       */ 
- double LMR_s = 2.0;                   /* smaller numbers increase reductions. */ 
- uint8_t LMR[32][64]; 
- int rep_index; 
- int search_depth = 0; 
- uint64_t search_nodes = 0; 
- uint64_t temp_search_nodes = 0; 
- int search_move = 0; 
- int predicted = 0; 
- int time_used = 0; 
- int time_used_opponent = 0; 
- int analyze_mode = 0; 
- int annotate_mode = 0; 
- int input_status = 0; 
- int resign = 9; 
- int resign_counter = 0; 
- int resign_count = 5; 
- int draw_counter = 0; 
- int draw_count = 5; 
- int draw_offer_pending = 0; 
- int draw_offered = 0; 
- int offer_draws = 1; 
- int dynamic_draw_score = 1; 
- int adaptive_hash = 0; 
- size_t adaptive_hash_min = 0; 
- size_t adaptive_hash_max = 0; 
- size_t adaptive_hashp_min = 0; 
- size_t adaptive_hashp_max = 0; 
- int time_limit = 100; 
- int force = 0; 
- char initial_position[80] = {""}; 
- char ponder_text[512] = {""}; 
- char book_hint[512] = {""}; 
- int over = 0; 
- int usage_level = 0; 
- char audible_alarm = 0x07; 
- char speech = 0; 
- int book_accept_mask = ~03; 
- int book_reject_mask = 3; 
- int book_random = 1; 
- float book_weight_learn = 1.0; 
- float book_weight_freq = 1.0; 
- float book_weight_eval = 0.1f; // Pierre-Marie Baty -- added type cast 
- int book_search_trigger = 20; 
- int learn = 1; 
- int learning = 100; 
- int learn_value = 0; 
- int abort_search;      /*  1 = abort / print stats, 2 = abort no print stats */ 
- int iteration; 
- int root_wtm = 1; 
- int last_root_value; 
- ROOT_MOVE root_moves[256]; 
- int n_root_moves; 
- int difficulty; 
- int absolute_time_limit; 
- int search_time_limit; 
- int burp; 
- int quit = 0; 
- unsigned opponent_start_time, opponent_end_time; 
- unsigned program_start_time, program_end_time; 
- unsigned start_time, end_time; 
- TREE *block[MAX_BLOCKS + 1]; 
- THREAD thread[CPUS]; 
- #if (CPUS > 1) 
- lock_t lock_smp, lock_io; 
- #if defined(UNIX) 
-   pthread_attr_t attributes; 
- #endif 
- #endif 
- unsigned int smp_max_threads = 0; 
- unsigned int smp_split_group = 8;       /* max threads per group              */ 
- unsigned int smp_split_at_root = 1;     /* enable split at root               */ 
- unsigned int smp_min_split_depth = 5;   /* don't split within 5 plies of tips */ 
- unsigned int smp_gratuitous_depth = 10; /* gratuitous splits if depth > 10    */ 
- unsigned int smp_gratuitous_limit = 6;  /* max gratuitous splits / thread     */ 
- int smp_affinity = 0;                   /* anything >= 0 is enabled           */ 
- int smp_numa = 0;                       /* disables NUMA mode by default      */ 
-                                         /* enable if you really have NUMA     */ 
- /* 
-       This is the autotune configuration section.  Each line represents one 
-       smp search parameter that can be tuned.  The first three values are the 
-       min, max and increment that autotune will use for this paramenter.  The 
-       fourth parameter is a string autotune will display to explain what it is 
-       currently tuning.  The fifth parameter is the command used to change this 
-       parameter (this is added to the .craftyrc/crafty.rc file after tuning is 
-       completed.  The last parameter is a pointer to the variable that must be 
-       changed to adjust the parameter while running the autotune tests. 
- */ 
- int autotune_params = 4; 
- struct autotune tune[16] = { 
-   { 4, 20, 4, "max thread group", "smpgroup", &smp_split_group}, 
-   { 4,  8, 1, "min split depth", "smpmin", &smp_min_split_depth}, 
-   {10, 16, 2, "min gratuitous split depth", "smpgsd", &smp_gratuitous_depth}, 
-   { 1,  8, 2, "gratuitous split limit", "smpgsl", &smp_gratuitous_limit}, 
- }; 
- unsigned parallel_splits; 
- unsigned parallel_splits_wasted; 
- unsigned parallel_aborts; 
- unsigned parallel_joins; 
- unsigned busy_percent = 0; 
- uint64_t game_max_blocks = 0; 
- volatile int smp_split = 0; 
- volatile int smp_threads = 0; 
- volatile int initialized_threads = 0; 
- int crafty_is_white = 0; 
- unsigned nodes_between_time_checks = 1000000; 
- unsigned nodes_per_second = 1000000; 
- int next_time_check = 100000; 
- int transposition_age = 0; 
- int thinking = 0; 
- int pondering = 0; 
- int puzzling = 0; 
- int booking = 0; 
- /************************************************************ 
-  *                                                          * 
-  *    1 -> display move/time/results/etc.                   * 
-  *    2 -> display PV.                                      * 
-  *    4 -> display fail high / fail low moves               * 
-  *    8 -> display search statistics.                       * 
-  *   16 -> display root moves as they are searched.         * 
-  *   32 -> display general informational messages.          * 
-  *   64 -> display ply-1 move list / flags after each       * 
-  *           iteration.                                     * 
-  *  128 -> display root moves and scores before search      * 
-  *           begins.                                        * 
-  * 2048 -> error messages (can not be disabled).            * 
-  *                                                          * 
-  ************************************************************ 
-  */ 
- int display_options = 1 | 2 | 8 | 16 | 32 | 2048; 
- unsigned noise_level = 100; 
- int noise_block = 0; 
- int tc_moves = 60; 
- int tc_time = 180000; 
- int tc_time_remaining[2] = {180000, 180000}; 
- int tc_moves_remaining[2] = {60, 60}; 
- int tc_secondary_moves = 30; 
- int tc_secondary_time = 90000; 
- int tc_increment = 0; 
- int tc_sudden_death = 0; 
- int tc_safety_margin = 0; 
- int draw_score[2] = {0, 0}; 
- char kibitz_text[4096]; 
- int kibitz_depth; 
- int move_number = 1; 
- int moves_out_of_book = 0; 
- int first_nonbook_factor = 0; 
- int first_nonbook_span = 0; 
- int smp_nice = 1; 
- #if defined(SKILL) 
- int skill = 100; 
- #endif 
- int show_book = 0; 
- int book_selection_width = 5; 
- int ponder = 1; 
- int trace_level = 0; 
- /*  for the following 6 lines, each pair should have */ 
- /*  the same numeric value (the size value).         */ 
- size_t hash_table_size = 1ull << 20; 
- uint64_t hash_mask = ((1ull << 20) - 1) & ~3; 
- size_t hash_path_size = 1ull << 16; 
- uint64_t hash_path_mask = ((1ull << 16) - 1) & ~15; 
- size_t pawn_hash_table_size = 1ull << 18; 
- uint64_t pawn_hash_mask = (1ull << 18) - 1; 
- uint64_t mask_clear_entry = 0xff9ffffffffe0000ull; 
- size_t eval_hash_table_size = 65536; 
- uint64_t eval_hash_mask = 65536 - 1; 
- int abs_draw_score = 0; 
- int accept_draws = 1; 
- const char translate[13] = 
-     {'k', 'q', 'r', 'b', 'n', 'p', 0, 'P', 'N', 'B', 'R', 'Q', 'K'}; 
- const uint64_t magic_bishop[64] = { 
-   0x0002020202020200ull, 0x0002020202020000ull, 0x0004010202000000ull, 
-   0x0004040080000000ull, 0x0001104000000000ull, 0x0000821040000000ull, 
-   0x0000410410400000ull, 0x0000104104104000ull, 0x0000040404040400ull, 
-   0x0000020202020200ull, 0x0000040102020000ull, 0x0000040400800000ull, 
-   0x0000011040000000ull, 0x0000008210400000ull, 0x0000004104104000ull, 
-   0x0000002082082000ull, 0x0004000808080800ull, 0x0002000404040400ull, 
-   0x0001000202020200ull, 0x0000800802004000ull, 0x0000800400A00000ull, 
-   0x0000200100884000ull, 0x0000400082082000ull, 0x0000200041041000ull, 
-   0x0002080010101000ull, 0x0001040008080800ull, 0x0000208004010400ull, 
-   0x0000404004010200ull, 0x0000840000802000ull, 0x0000404002011000ull, 
-   0x0000808001041000ull, 0x0000404000820800ull, 0x0001041000202000ull, 
-   0x0000820800101000ull, 0x0000104400080800ull, 0x0000020080080080ull, 
-   0x0000404040040100ull, 0x0000808100020100ull, 0x0001010100020800ull, 
-   0x0000808080010400ull, 0x0000820820004000ull, 0x0000410410002000ull, 
-   0x0000082088001000ull, 0x0000002011000800ull, 0x0000080100400400ull, 
-   0x0001010101000200ull, 0x0002020202000400ull, 0x0001010101000200ull, 
-   0x0000410410400000ull, 0x0000208208200000ull, 0x0000002084100000ull, 
-   0x0000000020880000ull, 0x0000001002020000ull, 0x0000040408020000ull, 
-   0x0004040404040000ull, 0x0002020202020000ull, 0x0000104104104000ull, 
-   0x0000002082082000ull, 0x0000000020841000ull, 0x0000000000208800ull, 
-   0x0000000010020200ull, 0x0000000404080200ull, 0x0000040404040400ull, 
-   0x0002020202020200ull 
- }; 
- const uint64_t magic_bishop_mask[64] = { 
-   0x0040201008040200ull, 0x0000402010080400ull, 0x0000004020100A00ull, 
-   0x0000000040221400ull, 0x0000000002442800ull, 0x0000000204085000ull, 
-   0x0000020408102000ull, 0x0002040810204000ull, 0x0020100804020000ull, 
-   0x0040201008040000ull, 0x00004020100A0000ull, 0x0000004022140000ull, 
-   0x0000000244280000ull, 0x0000020408500000ull, 0x0002040810200000ull, 
-   0x0004081020400000ull, 0x0010080402000200ull, 0x0020100804000400ull, 
-   0x004020100A000A00ull, 0x0000402214001400ull, 0x0000024428002800ull, 
-   0x0002040850005000ull, 0x0004081020002000ull, 0x0008102040004000ull, 
-   0x0008040200020400ull, 0x0010080400040800ull, 0x0020100A000A1000ull, 
-   0x0040221400142200ull, 0x0002442800284400ull, 0x0004085000500800ull, 
-   0x0008102000201000ull, 0x0010204000402000ull, 0x0004020002040800ull, 
-   0x0008040004081000ull, 0x00100A000A102000ull, 0x0022140014224000ull, 
-   0x0044280028440200ull, 0x0008500050080400ull, 0x0010200020100800ull, 
-   0x0020400040201000ull, 0x0002000204081000ull, 0x0004000408102000ull, 
-   0x000A000A10204000ull, 0x0014001422400000ull, 0x0028002844020000ull, 
-   0x0050005008040200ull, 0x0020002010080400ull, 0x0040004020100800ull, 
-   0x0000020408102000ull, 0x0000040810204000ull, 0x00000A1020400000ull, 
-   0x0000142240000000ull, 0x0000284402000000ull, 0x0000500804020000ull, 
-   0x0000201008040200ull, 0x0000402010080400ull, 0x0002040810204000ull, 
-   0x0004081020400000ull, 0x000A102040000000ull, 0x0014224000000000ull, 
-   0x0028440200000000ull, 0x0050080402000000ull, 0x0020100804020000ull, 
-   0x0040201008040200ull 
- }; 
- const unsigned magic_bishop_shift[64] = { 
-   58, 59, 59, 59, 59, 59, 59, 58, 
-   59, 59, 59, 59, 59, 59, 59, 59, 
-   59, 59, 57, 57, 57, 57, 59, 59, 
-   59, 59, 57, 55, 55, 57, 59, 59, 
-   59, 59, 57, 55, 55, 57, 59, 59, 
-   59, 59, 57, 57, 57, 57, 59, 59, 
-   59, 59, 59, 59, 59, 59, 59, 59, 
-   58, 59, 59, 59, 59, 59, 59, 58 
- }; 
- uint64_t magic_bishop_table[5248]; 
- uint64_t *magic_bishop_indices[64] = { 
-   magic_bishop_table + 4992, magic_bishop_table + 2624, 
-   magic_bishop_table + 256, magic_bishop_table + 896, 
-   magic_bishop_table + 1280, magic_bishop_table + 1664, 
-   magic_bishop_table + 4800, magic_bishop_table + 5120, 
-   magic_bishop_table + 2560, magic_bishop_table + 2656, 
-   magic_bishop_table + 288, magic_bishop_table + 928, 
-   magic_bishop_table + 1312, magic_bishop_table + 1696, 
-   magic_bishop_table + 4832, magic_bishop_table + 4928, 
-   magic_bishop_table + 0, magic_bishop_table + 128, 
-   magic_bishop_table + 320, magic_bishop_table + 960, 
-   magic_bishop_table + 1344, magic_bishop_table + 1728, 
-   magic_bishop_table + 2304, magic_bishop_table + 2432, 
-   magic_bishop_table + 32, magic_bishop_table + 160, 
-   magic_bishop_table + 448, magic_bishop_table + 2752, 
-   magic_bishop_table + 3776, magic_bishop_table + 1856, 
-   magic_bishop_table + 2336, magic_bishop_table + 2464, 
-   magic_bishop_table + 64, magic_bishop_table + 192, 
-   magic_bishop_table + 576, magic_bishop_table + 3264, 
-   magic_bishop_table + 4288, magic_bishop_table + 1984, 
-   magic_bishop_table + 2368, magic_bishop_table + 2496, 
-   magic_bishop_table + 96, magic_bishop_table + 224, 
-   magic_bishop_table + 704, magic_bishop_table + 1088, 
-   magic_bishop_table + 1472, magic_bishop_table + 2112, 
-   magic_bishop_table + 2400, magic_bishop_table + 2528, 
-   magic_bishop_table + 2592, magic_bishop_table + 2688, 
-   magic_bishop_table + 832, magic_bishop_table + 1216, 
-   magic_bishop_table + 1600, magic_bishop_table + 2240, 
-   magic_bishop_table + 4864, magic_bishop_table + 4960, 
-   magic_bishop_table + 5056, magic_bishop_table + 2720, 
-   magic_bishop_table + 864, magic_bishop_table + 1248, 
-   magic_bishop_table + 1632, magic_bishop_table + 2272, 
-   magic_bishop_table + 4896, magic_bishop_table + 5184 
- }; 
- int16_t magic_bishop_mobility_table[5248]; 
- int16_t *magic_bishop_mobility_indices[64] = { 
-   magic_bishop_mobility_table + 4992, magic_bishop_mobility_table + 2624, 
-   magic_bishop_mobility_table + 256, magic_bishop_mobility_table + 896, 
-   magic_bishop_mobility_table + 1280, magic_bishop_mobility_table + 1664, 
-   magic_bishop_mobility_table + 4800, magic_bishop_mobility_table + 5120, 
-   magic_bishop_mobility_table + 2560, magic_bishop_mobility_table + 2656, 
-   magic_bishop_mobility_table + 288, magic_bishop_mobility_table + 928, 
-   magic_bishop_mobility_table + 1312, magic_bishop_mobility_table + 1696, 
-   magic_bishop_mobility_table + 4832, magic_bishop_mobility_table + 4928, 
-   magic_bishop_mobility_table + 0, magic_bishop_mobility_table + 128, 
-   magic_bishop_mobility_table + 320, magic_bishop_mobility_table + 960, 
-   magic_bishop_mobility_table + 1344, magic_bishop_mobility_table + 1728, 
-   magic_bishop_mobility_table + 2304, magic_bishop_mobility_table + 2432, 
-   magic_bishop_mobility_table + 32, magic_bishop_mobility_table + 160, 
-   magic_bishop_mobility_table + 448, magic_bishop_mobility_table + 2752, 
-   magic_bishop_mobility_table + 3776, magic_bishop_mobility_table + 1856, 
-   magic_bishop_mobility_table + 2336, magic_bishop_mobility_table + 2464, 
-   magic_bishop_mobility_table + 64, magic_bishop_mobility_table + 192, 
-   magic_bishop_mobility_table + 576, magic_bishop_mobility_table + 3264, 
-   magic_bishop_mobility_table + 4288, magic_bishop_mobility_table + 1984, 
-   magic_bishop_mobility_table + 2368, magic_bishop_mobility_table + 2496, 
-   magic_bishop_mobility_table + 96, magic_bishop_mobility_table + 224, 
-   magic_bishop_mobility_table + 704, magic_bishop_mobility_table + 1088, 
-   magic_bishop_mobility_table + 1472, magic_bishop_mobility_table + 2112, 
-   magic_bishop_mobility_table + 2400, magic_bishop_mobility_table + 2528, 
-   magic_bishop_mobility_table + 2592, magic_bishop_mobility_table + 2688, 
-   magic_bishop_mobility_table + 832, magic_bishop_mobility_table + 1216, 
-   magic_bishop_mobility_table + 1600, magic_bishop_mobility_table + 2240, 
-   magic_bishop_mobility_table + 4864, magic_bishop_mobility_table + 4960, 
-   magic_bishop_mobility_table + 5056, magic_bishop_mobility_table + 2720, 
-   magic_bishop_mobility_table + 864, magic_bishop_mobility_table + 1248, 
-   magic_bishop_mobility_table + 1632, magic_bishop_mobility_table + 2272, 
-   magic_bishop_mobility_table + 4896, magic_bishop_mobility_table + 5184 
- }; 
- uint64_t magic_rook_table[102400]; 
- uint64_t *magic_rook_indices[64] = { 
-   magic_rook_table + 86016, magic_rook_table + 73728, 
-   magic_rook_table + 36864, magic_rook_table + 43008, 
-   magic_rook_table + 47104, magic_rook_table + 51200, 
-   magic_rook_table + 77824, magic_rook_table + 94208, 
-   magic_rook_table + 69632, magic_rook_table + 32768, 
-   magic_rook_table + 38912, magic_rook_table + 10240, 
-   magic_rook_table + 14336, magic_rook_table + 53248, 
-   magic_rook_table + 57344, magic_rook_table + 81920, 
-   magic_rook_table + 24576, magic_rook_table + 33792, 
-   magic_rook_table + 6144, magic_rook_table + 11264, 
-   magic_rook_table + 15360, magic_rook_table + 18432, 
-   magic_rook_table + 58368, magic_rook_table + 61440, 
-   magic_rook_table + 26624, magic_rook_table + 4096, 
-   magic_rook_table + 7168, magic_rook_table + 0, 
-   magic_rook_table + 2048, magic_rook_table + 19456, 
-   magic_rook_table + 22528, magic_rook_table + 63488, 
-   magic_rook_table + 28672, magic_rook_table + 5120, 
-   magic_rook_table + 8192, magic_rook_table + 1024, 
-   magic_rook_table + 3072, magic_rook_table + 20480, 
-   magic_rook_table + 23552, magic_rook_table + 65536, 
-   magic_rook_table + 30720, magic_rook_table + 34816, 
-   magic_rook_table + 9216, magic_rook_table + 12288, 
-   magic_rook_table + 16384, magic_rook_table + 21504, 
-   magic_rook_table + 59392, magic_rook_table + 67584, 
-   magic_rook_table + 71680, magic_rook_table + 35840, 
-   magic_rook_table + 39936, magic_rook_table + 13312, 
-   magic_rook_table + 17408, magic_rook_table + 54272, 
-   magic_rook_table + 60416, magic_rook_table + 83968, 
-   magic_rook_table + 90112, magic_rook_table + 75776, 
-   magic_rook_table + 40960, magic_rook_table + 45056, 
-   magic_rook_table + 49152, magic_rook_table + 55296, 
-   magic_rook_table + 79872, magic_rook_table + 98304 
- }; 
- int16_t magic_rook_mobility_table[102400]; 
- int16_t *magic_rook_mobility_indices[64] = { 
-   magic_rook_mobility_table + 86016, magic_rook_mobility_table + 73728, 
-   magic_rook_mobility_table + 36864, magic_rook_mobility_table + 43008, 
-   magic_rook_mobility_table + 47104, magic_rook_mobility_table + 51200, 
-   magic_rook_mobility_table + 77824, magic_rook_mobility_table + 94208, 
-   magic_rook_mobility_table + 69632, magic_rook_mobility_table + 32768, 
-   magic_rook_mobility_table + 38912, magic_rook_mobility_table + 10240, 
-   magic_rook_mobility_table + 14336, magic_rook_mobility_table + 53248, 
-   magic_rook_mobility_table + 57344, magic_rook_mobility_table + 81920, 
-   magic_rook_mobility_table + 24576, magic_rook_mobility_table + 33792, 
-   magic_rook_mobility_table + 6144, magic_rook_mobility_table + 11264, 
-   magic_rook_mobility_table + 15360, magic_rook_mobility_table + 18432, 
-   magic_rook_mobility_table + 58368, magic_rook_mobility_table + 61440, 
-   magic_rook_mobility_table + 26624, magic_rook_mobility_table + 4096, 
-   magic_rook_mobility_table + 7168, magic_rook_mobility_table + 0, 
-   magic_rook_mobility_table + 2048, magic_rook_mobility_table + 19456, 
-   magic_rook_mobility_table + 22528, magic_rook_mobility_table + 63488, 
-   magic_rook_mobility_table + 28672, magic_rook_mobility_table + 5120, 
-   magic_rook_mobility_table + 8192, magic_rook_mobility_table + 1024, 
-   magic_rook_mobility_table + 3072, magic_rook_mobility_table + 20480, 
-   magic_rook_mobility_table + 23552, magic_rook_mobility_table + 65536, 
-   magic_rook_mobility_table + 30720, magic_rook_mobility_table + 34816, 
-   magic_rook_mobility_table + 9216, magic_rook_mobility_table + 12288, 
-   magic_rook_mobility_table + 16384, magic_rook_mobility_table + 21504, 
-   magic_rook_mobility_table + 59392, magic_rook_mobility_table + 67584, 
-   magic_rook_mobility_table + 71680, magic_rook_mobility_table + 35840, 
-   magic_rook_mobility_table + 39936, magic_rook_mobility_table + 13312, 
-   magic_rook_mobility_table + 17408, magic_rook_mobility_table + 54272, 
-   magic_rook_mobility_table + 60416, magic_rook_mobility_table + 83968, 
-   magic_rook_mobility_table + 90112, magic_rook_mobility_table + 75776, 
-   magic_rook_mobility_table + 40960, magic_rook_mobility_table + 45056, 
-   magic_rook_mobility_table + 49152, magic_rook_mobility_table + 55296, 
-   magic_rook_mobility_table + 79872, magic_rook_mobility_table + 98304 
- }; 
- const uint64_t magic_rook[64] = { 
-   0x0080001020400080ull, 0x0040001000200040ull, 0x0080081000200080ull, 
-   0x0080040800100080ull, 0x0080020400080080ull, 0x0080010200040080ull, 
-   0x0080008001000200ull, 0x0080002040800100ull, 0x0000800020400080ull, 
-   0x0000400020005000ull, 0x0000801000200080ull, 0x0000800800100080ull, 
-   0x0000800400080080ull, 0x0000800200040080ull, 0x0000800100020080ull, 
-   0x0000800040800100ull, 0x0000208000400080ull, 0x0000404000201000ull, 
-   0x0000808010002000ull, 0x0000808008001000ull, 0x0000808004000800ull, 
-   0x0000808002000400ull, 0x0000010100020004ull, 0x0000020000408104ull, 
-   0x0000208080004000ull, 0x0000200040005000ull, 0x0000100080200080ull, 
-   0x0000080080100080ull, 0x0000040080080080ull, 0x0000020080040080ull, 
-   0x0000010080800200ull, 0x0000800080004100ull, 0x0000204000800080ull, 
-   0x0000200040401000ull, 0x0000100080802000ull, 0x0000080080801000ull, 
-   0x0000040080800800ull, 0x0000020080800400ull, 0x0000020001010004ull, 
-   0x0000800040800100ull, 0x0000204000808000ull, 0x0000200040008080ull, 
-   0x0000100020008080ull, 0x0000080010008080ull, 0x0000040008008080ull, 
-   0x0000020004008080ull, 0x0000010002008080ull, 0x0000004081020004ull, 
-   0x0000204000800080ull, 0x0000200040008080ull, 0x0000100020008080ull, 
-   0x0000080010008080ull, 0x0000040008008080ull, 0x0000020004008080ull, 
-   0x0000800100020080ull, 0x0000800041000080ull, 0x00FFFCDDFCED714Aull, 
-   0x007FFCDDFCED714Aull, 0x003FFFCDFFD88096ull, 0x0000040810002101ull, 
-   0x0001000204080011ull, 0x0001000204000801ull, 0x0001000082000401ull, 
-   0x0001FFFAABFAD1A2ull 
- }; 
- const uint64_t magic_rook_mask[64] = { 
-   0x000101010101017Eull, 0x000202020202027Cull, 0x000404040404047Aull, 
-   0x0008080808080876ull, 0x001010101010106Eull, 0x002020202020205Eull, 
-   0x004040404040403Eull, 0x008080808080807Eull, 0x0001010101017E00ull, 
-   0x0002020202027C00ull, 0x0004040404047A00ull, 0x0008080808087600ull, 
-   0x0010101010106E00ull, 0x0020202020205E00ull, 0x0040404040403E00ull, 
-   0x0080808080807E00ull, 0x00010101017E0100ull, 0x00020202027C0200ull, 
-   0x00040404047A0400ull, 0x0008080808760800ull, 0x00101010106E1000ull, 
-   0x00202020205E2000ull, 0x00404040403E4000ull, 0x00808080807E8000ull, 
-   0x000101017E010100ull, 0x000202027C020200ull, 0x000404047A040400ull, 
-   0x0008080876080800ull, 0x001010106E101000ull, 0x002020205E202000ull, 
-   0x004040403E404000ull, 0x008080807E808000ull, 0x0001017E01010100ull, 
-   0x0002027C02020200ull, 0x0004047A04040400ull, 0x0008087608080800ull, 
-   0x0010106E10101000ull, 0x0020205E20202000ull, 0x0040403E40404000ull, 
-   0x0080807E80808000ull, 0x00017E0101010100ull, 0x00027C0202020200ull, 
-   0x00047A0404040400ull, 0x0008760808080800ull, 0x00106E1010101000ull, 
-   0x00205E2020202000ull, 0x00403E4040404000ull, 0x00807E8080808000ull, 
-   0x007E010101010100ull, 0x007C020202020200ull, 0x007A040404040400ull, 
-   0x0076080808080800ull, 0x006E101010101000ull, 0x005E202020202000ull, 
-   0x003E404040404000ull, 0x007E808080808000ull, 0x7E01010101010100ull, 
-   0x7C02020202020200ull, 0x7A04040404040400ull, 0x7608080808080800ull, 
-   0x6E10101010101000ull, 0x5E20202020202000ull, 0x3E40404040404000ull, 
-   0x7E80808080808000ull 
- }; 
- const unsigned magic_rook_shift[64] = { 
-   52, 53, 53, 53, 53, 53, 53, 52, 
-   53, 54, 54, 54, 54, 54, 54, 53, 
-   53, 54, 54, 54, 54, 54, 54, 53, 
-   53, 54, 54, 54, 54, 54, 54, 53, 
-   53, 54, 54, 54, 54, 54, 54, 53, 
-   53, 54, 54, 54, 54, 54, 54, 53, 
-   53, 54, 54, 54, 54, 54, 54, 53, 
-   53, 54, 54, 53, 53, 53, 53, 53 
- }; 
- const uint64_t mobility_mask_b[4] = { 
-   0xFF818181818181FFull, 0x007E424242427E00ull, 
-   0x00003C24243C0000ull, 0x0000001818000000ull 
- }; 
- const uint64_t mobility_mask_r[4] = { 
-   0x8181818181818181ull, 0x4242424242424242ull, 
-   0x2424242424242424ull, 0x1818181818181818ull 
- }; 
- /* 
-   values use to deal with white/black independently 
-  */ 
- const int rankflip[2][8] = { 
-   {RANK8, RANK7, RANK6, RANK5, RANK4, RANK3, RANK2, RANK1}, 
-   {RANK1, RANK2, RANK3, RANK4, RANK5, RANK6, RANK7, RANK8} 
- }; 
- const int sqflip[2][64] = { 
-  {A8, B8, C8, D8, E8, F8, G8, H8, 
-   A7, B7, C7, D7, E7, F7, G7, H7, 
-   A6, B6, C6, D6, E6, F6, G6, H6, 
-   A5, B5, C5, D5, E5, F5, G5, H5, 
-   A4, B4, C4, D4, E4, F4, G4, H4,   /* black */ 
-   A3, B3, C3, D3, E3, F3, G3, H3, 
-   A2, B2, C2, D2, E2, F2, G2, H2, 
-   A1, B1, C1, D1, E1, F1, G1, H1}, 
-   
-  {A1, B1, C1, D1, E1, F1, G1, H1, 
-   A2, B2, C2, D2, E2, F2, G2, H2, 
-   A3, B3, C3, D3, E3, F3, G3, H3, 
-   A4, B4, C4, D4, E4, F4, G4, H4, 
-   A5, B5, C5, D5, E5, F5, G5, H5,   /* white */ 
-   A6, B6, C6, D6, E6, F6, G6, H6, 
-   A7, B7, C7, D7, E7, F7, G7, H7, 
-   A8, B8, C8, D8, E8, F8, G8, H8} 
- }; 
- const int rank1[2] = {RANK8, RANK1}; 
- const int rank2[2] = {RANK7, RANK2}; 
- const int rank3[2] = {RANK6, RANK3}; 
- const int rank4[2] = {RANK5, RANK4}; 
- const int rank5[2] = {RANK4, RANK5}; 
- const int rank6[2] = {RANK3, RANK6}; 
- const int rank7[2] = {RANK2, RANK7}; 
- const int rank8[2] = {RANK1, RANK8}; 
- const int epdir[2] = {8, -8}; 
- const int csq[2] = {C8, C1}; 
- const int dsq[2] = {D8, D1}; 
- const int esq[2] = {E8, E1}; 
- const int fsq[2] = {F8, F1}; 
- const int gsq[2] = {G8, G1}; 
- uint64_t distance_ring[64][8]; 
- const int sign[2] = {-1, 1}; 
- const int epsq[2] = {+8, -8}; 
- const int rook_A[2] = {A8, A1}; 
- const int rook_D[2] = {D8, D1}; 
- const int rook_F[2] = {F8, F1}; 
- const int rook_G[2] = {G8, G1}; 
- const int rook_H[2] = {H8, H1}; 
- const int pawnadv1[2] = {+8, -8}; 
- const int pawnadv2[2] = {+16, -16}; 
- const int capleft[2] = {+9, -7}; 
- const int capright[2] = {+7, -9}; 
- const char empty_sqs[9] = {0, '1', '2', '3', '4', '5', '6', '7', '8'}; 
- const int pcval[7] = {0, 100, 300, 300, 500, 900, 9900}; 
- const int p_vals[7] = {0, 1, 3, 3, 5, 9, 99}; 
- const int MVV_LVA[7][7] = { 
-     {0,  5<<21,  4<<21,  4<<21,  3<<21,  2<<21,  1<<21}, 
-     {0, 10<<21,  9<<21,  9<<21,  8<<21,  7<<21,  6<<21}, 
-     {0, 15<<21, 14<<21, 14<<21, 13<<21, 12<<21, 11<<21}, 
-     {0, 15<<21, 14<<21, 14<<21, 13<<21, 12<<21, 11<<21}, 
-     {0, 20<<21, 19<<21, 19<<21, 18<<21, 17<<21, 16<<21}, 
-     {0, 25<<21, 24<<21, 24<<21, 23<<21, 22<<21, 21<<21}, 
-     {0, 30<<21, 29<<21, 29<<21, 28<<21, 27<<21, 26<<21}}; 
- const int pieces[2][7] = { 
-   {0, -1, -2, -3, -4, -5, -6}, 
-   {0, +1, +2, +3, +4, +5, +6} 
- }; 
- const int lower_n = 16; 
- const int lower_b = 10; 
- const int mobility_score_n[4] = {1, 2, 3, 4}; 
- const int mobility_score_b[4] = {1, 2, 3, 4}; 
- const int mobility_score_r[4] = {1, 2, 3, 4}; 
- const int mob_curve_r[48] = { 
-   -27,-23,-21,-19,-15,-10, -9, -8, 
-    -7, -6, -5, -4, -3, -2, -1,  0, 
-     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 
- }; 
- int piece_values[2][7] = { 
-   {0, -PAWN_VALUE, -KNIGHT_VALUE, -BISHOP_VALUE, 
-       -ROOK_VALUE, -QUEEN_VALUE,    -KING_VALUE}, 
-   {0,  PAWN_VALUE,  KNIGHT_VALUE,  BISHOP_VALUE, 
-        ROOK_VALUE,  QUEEN_VALUE,     KING_VALUE} 
- }; 
- /* 
-    First term is a character string explaining what the eval 
-    term is used for. 
-   
-   Second term is the "type" of the value. 
-      0 = heading entry (no values, just a category name to display). 
-      1 = scalar value. 
-      2 = array[mg] 
-      3 = floating point value 
-   
-    Third term is the "size" of the scoring term, where 0 is a 
-      scalar value, otherwise it is the actual number of elements in 
-      an array of values. 
-   
-    Fourth term is a pointer to the data value(s). 
- */ 
- struct personality_term personality_packet[256] = { 
-   {"search options                          ", 0, 0, NULL},        /*  0 */ 
-   {"check extension                         ", 1, 0, &check_depth}, 
-   {"null-move reduction                     ", 1, 0, &null_depth}, 
-   {"null-move adaptive divisor              ", 1, 0, &null_divisor}, 
-   {"LMR min distance to frontier            ", 1, 0, &LMR_rdepth}, 
-   {"LMR min reduction                       ", 1, 0, &LMR_min}, 
-   {"LMR max reduction                       ", 1, 0, &LMR_max}, 
-   {"LMR formula depth bias                  ", 3, 0, &LMR_db}, 
-   {"LMR formula moves searched bias         ", 3, 0, &LMR_mb}, 
-   {"LMR scale factor                        ", 3, 0, &LMR_s}, 
-   {"search options (continued)              ", 0, 0, NULL},        /* 10 */ 
-   {"prune depth                             ", 1, 0, &pruning_depth}, 
-   {"prune margin [remain_depth]             ", 4, 8, pruning_margin}, 
-   {NULL, 0, 0, NULL}, 
-   {NULL, 0, 0, NULL}, 
-   {NULL, 0, 0, NULL}, 
-   {NULL, 0, 0, NULL}, 
-   {NULL, 0, 0, NULL}, 
-   {NULL, 0, 0, NULL}, 
-   {NULL, 0, 0, NULL}, 
- }; 
- /* *INDENT-ON* */ 
-