Rev 108 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 108 | Rev 154 | ||
---|---|---|---|
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]; |
Line 41... | Line 41... | ||
41 | char pgn_black[128] = {"Crafty " VERSION}; |
41 | char pgn_round[128] = {"?"}; |
42 | char pgn_black_elo[128] = {""}; |
42 | char pgn_white[128] = {"unknown"}; |
43 | char pgn_result[128] = {"*"}; |
43 | char pgn_white_elo[128] = {""}; |
44 | char *B_list[128]; |
44 | char pgn_black[128] = {"Crafty " VERSION}; |
45 | char *AK_list[128]; |
45 | char pgn_black_elo[128] = {""}; |
46 | char *GM_list[128]; |
- | |
47 | char *IM_list[128]; |
46 | char pgn_result[128] = {"*"}; |
48 | char *SP_list[128]; |
47 | char *B_list[128]; |
49 | char *SP_opening_filename[128]; |
48 | char *AK_list[128]; |
50 | char *SP_personality_filename[128]; |
49 | char *GM_list[128]; |
51 | int output_format = 0; |
50 | char *IM_list[128]; |
52 | #if !defined(NOEGTB) |
51 | char *SP_list[128]; |
53 | int EGTBlimit = 0; |
- | |
54 | int EGTB_use = 0; |
- | |
55 | int EGTB_draw = 0; |
52 | char *SP_opening_filename[128]; |
56 | int EGTB_depth = 6; |
53 | char *SP_personality_filename[128]; |
57 | size_t EGTB_cache_size = 4096 * 4096; |
54 | int output_format = 0; |
58 | void *EGTB_cache = (void *) 0; |
55 | #if defined(SYZYGY) |
59 | int EGTB_setup = 0; |
56 | int EGTBlimit = 0; |
Line 443... | Line 440... | ||
443 | magic_rook_mobility_table + 71680, magic_rook_mobility_table + 35840, |
440 | magic_rook_mobility_table + 28672, magic_rook_mobility_table + 5120, |
444 | magic_rook_mobility_table + 39936, magic_rook_mobility_table + 13312, |
441 | magic_rook_mobility_table + 8192, magic_rook_mobility_table + 1024, |
445 | magic_rook_mobility_table + 17408, magic_rook_mobility_table + 54272, |
442 | magic_rook_mobility_table + 3072, magic_rook_mobility_table + 20480, |
446 | magic_rook_mobility_table + 60416, magic_rook_mobility_table + 83968, |
443 | magic_rook_mobility_table + 23552, magic_rook_mobility_table + 65536, |
447 | magic_rook_mobility_table + 90112, magic_rook_mobility_table + 75776, |
444 | magic_rook_mobility_table + 30720, magic_rook_mobility_table + 34816, |
448 | magic_rook_mobility_table + |
445 | magic_rook_mobility_table + 9216, magic_rook_mobility_table + 12288, |
449 | magic_rook_mobility_table + 49152, magic_rook_mobility_table + 55296, |
446 | magic_rook_mobility_table + 16384, magic_rook_mobility_table + 21504, |
450 | magic_rook_mobility_table + 79872, magic_rook_mobility_table + 98304 |
447 | magic_rook_mobility_table + 59392, magic_rook_mobility_table + 67584, |
451 | }; |
448 | magic_rook_mobility_table + 71680, magic_rook_mobility_table + 35840, |
452 | const uint64_t magic_rook[64] = { |
449 | magic_rook_mobility_table + 39936, magic_rook_mobility_table + 13312, |
453 | 0x0080001020400080ull, 0x0040001000200040ull, 0x0080081000200080ull, |
450 | magic_rook_mobility_table + 17408, magic_rook_mobility_table + 54272, |
454 | 0x0080040800100080ull, 0x0080020400080080ull, 0x0080010200040080ull, |
451 | magic_rook_mobility_table + 60416, magic_rook_mobility_table + 83968, |
455 | 0x0080008001000200ull, 0x0080002040800100ull, 0x0000800020400080ull, |
452 | magic_rook_mobility_table + 90112, magic_rook_mobility_table + 75776, |
456 | 0x0000400020005000ull, 0x0000801000200080ull, 0x0000800800100080ull, |
453 | magic_rook_mobility_table + 40960, magic_rook_mobility_table + 45056, |
457 |
|
454 | magic_rook_mobility_table + 49152, magic_rook_mobility_table + 55296, |
- | 455 | magic_rook_mobility_table + 79872, magic_rook_mobility_table + 98304 |
|
458 |
|
456 | }; |
- | 457 | const uint64_t magic_rook[64] = { |
|
459 |
|
458 | 0x0080001020400080ull, 0x0040001000200040ull, 0x0080081000200080ull, |
460 |
|
459 | 0x0080040800100080ull, 0x0080020400080080ull, 0x0080010200040080ull, |
- | 460 | 0x0080008001000200ull, 0x0080002040800100ull, 0x0000800020400080ull, |
|
461 | 0x0000208080004000ull, 0x0000200040005000ull, 0x0000100080200080ull, |
461 | 0x0000400020005000ull, 0x0000801000200080ull, 0x0000800800100080ull, |
462 | 0x0000080080100080ull, 0x0000040080080080ull, 0x0000020080040080ull, |
462 | 0x0000800400080080ull, 0x0000800200040080ull, 0x0000800100020080ull, |
463 | 0x0000010080800200ull, 0x0000800080004100ull, 0x0000204000800080ull, |
463 | 0x0000800040800100ull, 0x0000208000400080ull, 0x0000404000201000ull, |
464 | 0x0000200040401000ull, 0x0000100080802000ull, 0x0000080080801000ull, |
464 | 0x0000808010002000ull, 0x0000808008001000ull, 0x0000808004000800ull, |
465 | 0x0000040080800800ull, 0x0000020080800400ull, 0x0000020001010004ull, |
465 | 0x0000808002000400ull, 0x0000010100020004ull, 0x0000020000408104ull, |
Line 474... | Line 474... | ||
474 | 0x0001FFFAABFAD1A2ull |
474 | 0x0000204000800080ull, 0x0000200040008080ull, 0x0000100020008080ull, |
475 | }; |
475 | 0x0000080010008080ull, 0x0000040008008080ull, 0x0000020004008080ull, |
476 | const uint64_t magic_rook_mask[64] = { |
476 | 0x0000800100020080ull, 0x0000800041000080ull, 0x00FFFCDDFCED714Aull, |
477 | 0x000101010101017Eull, 0x000202020202027Cull, 0x000404040404047Aull, |
477 | 0x007FFCDDFCED714Aull, 0x003FFFCDFFD88096ull, 0x0000040810002101ull, |
478 | 0x0008080808080876ull, 0x001010101010106Eull, 0x002020202020205Eull, |
478 | 0x0001000204080011ull, 0x0001000204000801ull, 0x0001000082000401ull, |
479 |
|
479 | 0x0001FFFAABFAD1A2ull |
480 | 0x0002020202027C00ull, 0x0004040404047A00ull, 0x0008080808087600ull, |
480 | }; |
481 | 0x0010101010106E00ull, 0x0020202020205E00ull, 0x0040404040403E00ull, |
481 | const uint64_t magic_rook_mask[64] = { |
482 | 0x0080808080807E00ull, 0x00010101017E0100ull, 0x00020202027C0200ull, |
482 | 0x000101010101017Eull, 0x000202020202027Cull, 0x000404040404047Aull, |
483 |
|
483 | 0x0008080808080876ull, 0x001010101010106Eull, 0x002020202020205Eull, |
484 | 0x00202020205E2000ull, 0x00404040403E4000ull, 0x00808080807E8000ull, |
484 | 0x004040404040403Eull, 0x008080808080807Eull, 0x0001010101017E00ull, |
485 | 0x000101017E010100ull, 0x000202027C020200ull, 0x000404047A040400ull, |
485 | 0x0002020202027C00ull, 0x0004040404047A00ull, 0x0008080808087600ull, |
486 | 0x0008080876080800ull, 0x001010106E101000ull, 0x002020205E202000ull, |
486 | 0x0010101010106E00ull, 0x0020202020205E00ull, 0x0040404040403E00ull, |
487 | 0x004040403E404000ull, 0x008080807E808000ull, 0x0001017E01010100ull, |
487 | 0x0080808080807E00ull, 0x00010101017E0100ull, 0x00020202027C0200ull, |
488 | 0x0002027C02020200ull, 0x0004047A04040400ull, 0x0008087608080800ull, |
488 | 0x00040404047A0400ull, 0x0008080808760800ull, 0x00101010106E1000ull, |
489 | 0x0010106E10101000ull, 0x0020205E20202000ull, 0x0040403E40404000ull, |
489 | 0x00202020205E2000ull, 0x00404040403E4000ull, 0x00808080807E8000ull, |
490 | 0x0080807E80808000ull, 0x00017E0101010100ull, 0x00027C0202020200ull, |
490 | 0x000101017E010100ull, 0x000202027C020200ull, 0x000404047A040400ull, |
491 | 0x00047A0404040400ull, 0x0008760808080800ull, 0x00106E1010101000ull, |
491 | 0x0008080876080800ull, 0x001010106E101000ull, 0x002020205E202000ull, |
492 | 0x00205E2020202000ull, 0x00403E4040404000ull, 0x00807E8080808000ull, |
- | |
493 | 0x007E010101010100ull, 0x007C020202020200ull, 0x007A040404040400ull, |
492 | 0x004040403E404000ull, 0x008080807E808000ull, 0x0001017E01010100ull, |
494 | 0x0076080808080800ull, 0x006E101010101000ull, 0x005E202020202000ull, |
493 | 0x0002027C02020200ull, 0x0004047A04040400ull, 0x0008087608080800ull, |
495 | 0x003E404040404000ull, 0x007E808080808000ull, 0x7E01010101010100ull, |
494 | 0x0010106E10101000ull, 0x0020205E20202000ull, 0x0040403E40404000ull, |
496 | 0x7C02020202020200ull, 0x7A04040404040400ull, 0x7608080808080800ull, |
495 | 0x0080807E80808000ull, 0x00017E0101010100ull, 0x00027C0202020200ull, |
497 | 0x6E10101010101000ull, 0x5E20202020202000ull, 0x3E40404040404000ull, |
496 | 0x00047A0404040400ull, 0x0008760808080800ull, 0x00106E1010101000ull, |
498 | 0x7E80808080808000ull |
497 | 0x00205E2020202000ull, 0x00403E4040404000ull, 0x00807E8080808000ull, |
499 | }; |
498 | 0x007E010101010100ull, 0x007C020202020200ull, 0x007A040404040400ull, |
500 |
|
499 | 0x0076080808080800ull, 0x006E101010101000ull, 0x005E202020202000ull, |
501 | 52, 53, 53, 53, 53, 53, 53, 52, |
500 | 0x003E404040404000ull, 0x007E808080808000ull, 0x7E01010101010100ull, |
502 | 53, 54, 54, 54, 54, 54, 54, 53, |
501 | 0x7C02020202020200ull, 0x7A04040404040400ull, 0x7608080808080800ull, |
503 | 53, 54, 54, 54, 54, 54, 54, 53, |
502 | 0x6E10101010101000ull, 0x5E20202020202000ull, 0x3E40404040404000ull, |
504 | 53, 54, 54, 54, 54, 54, 54, 53, |
503 | 0x7E80808080808000ull |
505 | 53, 54, 54, 54, 54, 54, 54, 53, |
504 | }; |
Line 547... | Line 546... | ||
547 | const int rank4[2] = {RANK5, RANK4}; |
546 | A7, B7, C7, D7, E7, F7, G7, H7, |
548 | const int rank5[2] = {RANK4, RANK5}; |
547 | A8, B8, C8, D8, E8, F8, G8, H8} |
549 | const int rank6[2] = {RANK3, RANK6}; |
548 | }; |
550 | const int rank7[2] = {RANK2, RANK7}; |
549 | const int rank1[2] = {RANK8, RANK1}; |
551 | const int rank8[2] = {RANK1, RANK8}; |
550 | const int rank2[2] = {RANK7, RANK2}; |
552 | const int |
551 | const int rank3[2] = {RANK6, RANK3}; |
553 | const int csq[2] = {C8, C1}; |
552 | const int rank4[2] = {RANK5, RANK4}; |
554 | const int dsq[2] = {D8, D1}; |
553 | const int rank5[2] = {RANK4, RANK5}; |
555 | const int esq[2] = {E8, E1}; |
554 | const int rank6[2] = {RANK3, RANK6}; |
556 | const int fsq[2] = {F8, F1}; |
555 | const int rank7[2] = {RANK2, RANK7}; |
557 | const int gsq[2] = {G8, G1}; |
556 | const int rank8[2] = {RANK1, RANK8}; |
Line 574... | Line 573... | ||
574 | {0, 5<<21, 4<<21, 4<<21, 3<<21, 2<<21, 1<<21}, |
573 | const int capleft[2] = {+9, -7}; |
575 | {0, 10<<21, 9<<21, 9<<21, 8<<21, 7<<21, 6<<21}, |
574 | const int capright[2] = {+7, -9}; |
576 | {0, 15<<21, 14<<21, 14<<21, 13<<21, 12<<21, 11<<21}, |
575 | const char empty_sqs[9] = {0, '1', '2', '3', '4', '5', '6', '7', '8'}; |
577 | {0, 15<<21, 14<<21, 14<<21, 13<<21, 12<<21, 11<<21}, |
576 | const int pcval[7] = {0, 100, 300, 300, 500, 900, 9900}; |
578 | {0, 20<<21, 19<<21, 19<<21, 18<<21, 17<<21, 16<<21}, |
577 | const int p_vals[7] = {0, 1, 3, 3, 5, 9, 99}; |
- | 578 | const int MVV_LVA[7][7] = { |
|
579 | {0, 25<<21, 24<<21, 24<<21, 23<<21, 22<<21, 21<<21}, |
579 | {0, 5<<21, 4<<21, 4<<21, 3<<21, 2<<21, 1<<21}, |
580 | {0, 30<<21, 29<<21, 29<<21, 28<<21, 27<<21, 26<<21}}; |
580 | {0, 10<<21, 9<<21, 9<<21, 8<<21, 7<<21, 6<<21}, |
581 | const int pieces[2][7] = { |
581 | {0, 15<<21, 14<<21, 14<<21, 13<<21, 12<<21, 11<<21}, |
582 | {0, -1, -2, -3, -4, -5, -6}, |
582 | {0, 15<<21, 14<<21, 14<<21, 13<<21, 12<<21, 11<<21}, |
583 | {0, +1, +2, +3, +4, +5, +6} |
583 | {0, 20<<21, 19<<21, 19<<21, 18<<21, 17<<21, 16<<21}, |
584 | }; |
584 | {0, 25<<21, 24<<21, 24<<21, 23<<21, 22<<21, 21<<21}, |
- | 585 | {0, 30<<21, 29<<21, 29<<21, 28<<21, 27<<21, 26<<21}}; |
|
585 | const int lower_n = 16; |
586 | const int pieces[2][7] = { |
- | 587 | {0, -1, -2, -3, -4, -5, -6}, |
|
- | 588 | {0, +1, +2, +3, +4, +5, +6} |
|
- | 589 | }; |
|
- | 590 | const int lower_n = 16; |
|
586 | const int lower_b = 10; |
591 | const int lower_b = 10; |
587 | const int mobility_score_n[4] = {1, 2, 3, 4}; |
592 | const int mobility_score_n[4] = {1, 2, 3, 4}; |
588 | const int mobility_score_b[4] = {1, 2, 3, 4}; |
593 | const int mobility_score_b[4] = {1, 2, 3, 4}; |
589 | const int mobility_score_r[4] = {1, 2, 3, 4}; |
594 | const int mobility_score_r[4] = {1, 2, 3, 4}; |
590 | const int mob_curve_r[48] = { |
595 | const int mob_curve_r[48] = { |
Line 653... | Line 658... | ||
653 | 658 | ||
654 | 659 | ||
655 | 660 | ||
656 | 661 | ||
657 | 662 | ||
658 | - | ||
659 | 663 | ||
660 | 664 | ||
661 | 665 | ||
662 | 666 | ||
663 | 667 | ||
Line 670... | Line 674... | ||
670 | 674 | ||
671 | 675 | ||
672 | 676 | ||
673 | 677 | ||
674 | 678 | ||
675 | - | ||
676 | - | ||
677 | 679 | ||
678 | 680 | ||
679 | 681 | ||
680 | 682 | ||
681 | 683 | ||
Line 1054... | Line 1056... | ||
1054 | 1056 | ||
1055 | 1057 | ||
1056 | 1058 | ||
1057 | 1059 | ||
1058 | 1060 | ||
1059 | - | ||
1060 | - | ||
1061 | - | ||
1062 | - | ||
1063 | - | ||
1064 | - | ||
1065 | - | ||
1066 | - | ||
1067 | 1061 | ||
1068 | 1062 | ||
1069 | 1063 |