-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththc.cpp
12776 lines (12282 loc) · 460 KB
/
thc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/****************************************************************************
* Triple Happy Chess library = thc library
* This is thc rendered as a single thc.h header + thc.cpp source file to
* avoid the complications of libraries - Inspired by sqlite.c
*
* Author: Bill Forster
* License: MIT license. Full text of license is in associated file LICENSE
* Copyright 2010-2014, Bill Forster <billforsternz at gmail dot com>
****************************************************************************/
/*
thc.cpp The basic idea is to concatenate the following into one .cpp file;
Portability.cpp
PrivateChessDefs.h
HashLookup.h
ChessPosition.cpp
ChessRules.cpp
ChessEvaluation.cpp
ChessEngine.cpp <-- removed in this version for simplicity
Move.cpp
PrivateChessDefs.cpp
nested inline expansion of -> GeneratedLookupTables.h
*/
// Don't reproduce this section
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <algorithm>
#include "thc.h"
using namespace std;
using namespace thc;
/****************************************************************************
* Portability.cpp Simple definitions to aid platform portability
* Author: Bill Forster
* License: MIT license. Full text of license is in associated file LICENSE
* Copyright 2010-2014, Bill Forster <billforsternz at gmail dot com>
****************************************************************************/
// return 0 if case insensitive match
int strcmp_ignore( const char *s, const char *t )
{
bool same=true;
while( *s && *t && same )
{
char c = *s++;
char d = *t++;
same = (c==d) || (isascii(c) && isascii(d) && toupper(c)==toupper(d));
}
if( *s || *t )
same = false;
return same?0:1;
}
/****************************************************************************
* PrivateChessDefs.h Chess classes - Internal implementation details
* Author: Bill Forster
* License: MIT license. Full text of license is in associated file LICENSE
* Copyright 2010-2014, Bill Forster <billforsternz at gmail dot com>
****************************************************************************/
#ifndef PRIVATE_CHESS_DEFS_H_INCLUDED
#define PRIVATE_CHESS_DEFS_H_INCLUDED
// TripleHappyChess
namespace thc
{
// Check whether a piece is black, white or an empty square, should really make
// these and most other macros into inline functions
#define IsEmptySquare(p) ((p)==' ')
#define IsBlack(p) ((p)>'a') // all lower case pieces
#define IsWhite(p) ((p)<'a' && (p)!=' ') // all upper case pieces, and not empty
// Allow easy iteration through squares
inline Square& operator++ ( Square& sq )
{
sq = (Square)(sq+1);
return sq;
}
// Macro to convert chess notation to Square convention,
// eg SQ('c','5') -> c5
// (We didn't always have such a sensible Square convention. SQ() remains
// useful for cases like SQ(file,rank), but you may actually see examples
// like the hardwired SQ('c','5') which can safely be changed to simply
// c5).
#define SQ(f,r) ( (Square) ( ('8'-(r))*8 + ((f)-'a') ) )
// More Square macros
#define FILE(sq) ( (char) ( ((sq)&0x07) + 'a' ) ) // eg c5->'c'
#define RANK(sq) ( (char) ( '8' - (((sq)>>3) & 0x07) ) ) // eg c5->'5'
#define IFILE(sq) ( (int)(sq) & 0x07 ) // eg c5->2
#define IRANK(sq) ( 7 - ((((int)(sq)) >>3) & 0x07) ) // eg c5->4
#define SOUTH(sq) ( (Square)((sq) + 8) ) // eg c5->c4
#define NORTH(sq) ( (Square)((sq) - 8) ) // eg c5->c6
#define SW(sq) ( (Square)((sq) + 7) ) // eg c5->b4
#define SE(sq) ( (Square)((sq) + 9) ) // eg c5->d4
#define NW(sq) ( (Square)((sq) - 9) ) // eg c5->b6
#define NE(sq) ( (Square)((sq) - 7) ) // eg c5->d6
// Utility macro
#ifndef nbrof
#define nbrof(array) (sizeof((array))/sizeof((array)[0]))
#endif
/* DETAIL is shorthand for the section of type ChessPosition that looks
like this;
Square enpassant_target : 8;
Square wking_square : 8;
Square bking_square : 8;
int wking : 1;
int wqueen : 1;
int bking : 1;
int bqueen : 1;
We assume it is located in the last 4 bytes of ChessPosition,
hence the definition of typedef DETAIL as unsigned long, and
of DETAIL_ADDR below. We assume that ANDing the unsigned
character at this address + 3, with ~WKING, where WKING
is defined as unsigned char 0x01, will clear wking. See the
definition of DETAIL_CASTLING and castling_prohibited_table[].
These assumptions are likely not portable and are tested in
TestInternals(). If porting this code, step through that code
first and make any adjustments necessary */
#define DETAIL_ADDR ( (DETAIL*) ((char *)this + sizeof(ChessPosition) - sizeof(DETAIL)) )
#define DETAIL_SAVE DETAIL tmp = *DETAIL_ADDR
#define DETAIL_RESTORE *DETAIL_ADDR = tmp
#define DETAIL_EQ_ALL ( (*DETAIL_ADDR&0x0fffffff) == (tmp&0x0fffffff) )
#define DETAIL_EQ_CASTLING ( (*DETAIL_ADDR&0x0f000000) == (tmp&0x0f000000) )
#define DETAIL_EQ_KING_POSITIONS ( (*DETAIL_ADDR&0x00ffff00) == (tmp&0x00ffff00) )
#define DETAIL_EQ_EN_PASSANT ( (*DETAIL_ADDR&0x000000ff) == (tmp&0x000000ff) )
#define DETAIL_PUSH detail_stack[detail_idx++] = *DETAIL_ADDR
#define DETAIL_POP *DETAIL_ADDR = detail_stack[--detail_idx]
#define DETAIL_CASTLING(sq) *( 3 + (unsigned char*)DETAIL_ADDR ) &= castling_prohibited_table[sq]
// Bits corresponding to detail bits wking, wqueen, bking, bqueen for
// DETAIL_CASTLING
#define WKING 0x01
#define WQUEEN 0x02
#define BKING 0x04
#define BQUEEN 0x08
// Convert piece, eg 'N' to bitmask in lookup tables. See automatically
// PrivateChessDefs.cpp and GeneratedLookupTables.h for format of
// lookup tables
extern lte to_mask[];
// Lookup squares a queen can move to
extern const lte *queen_lookup[];
// Lookup squares a rook can move to
extern const lte *rook_lookup[];
// Lookup squares a bishop can move to
extern const lte *bishop_lookup[];
// Lookup squares a knight can move to
extern const lte *knight_lookup[];
// Lookup squares a king can move to
extern const lte *king_lookup[];
// Lookup squares a white pawn can move to
extern const lte *pawn_white_lookup[];
// Lookup squares a black pawn can move to
extern const lte *pawn_black_lookup[];
// Lookup good squares for enemy king when a king is on a square in an endgame
extern const lte *good_king_position_lookup[];
// Lookup squares from which an enemy pawn attacks white
extern const lte *pawn_attacks_white_lookup[];
// Lookup squares from which an enemy pawn attacks black
extern const lte *pawn_attacks_black_lookup[];
// Lookup squares from which enemy pieces attack white
extern const lte *attacks_white_lookup[];
// Lookup squares from which enemy pieces attack black
extern const lte *attacks_black_lookup[];
} //namespace thc
#endif // PRIVATE_CHESS_DEFS_H_INCLUDED
/****************************************************************************
* HashLookup.h Quickly generate position hash codes with these lookup tables
* Author: Bill Forster
* License: MIT license. Full text of license is in associated file LICENSE
* Copyright 2010-2014, Bill Forster <billforsternz at gmail dot com>
****************************************************************************/
static uint32_t hash_lookup[64]['r'-'B'+1] =
{ // B K N P Q R
{ 0x8c7f0aac,0,0,0,0,0,0,0,0,0x97c4aa2f,0,0,0xb716a675,0,0xd821ccc0,0x9a4eb343,0xdba252fb, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x8b7d76c3, // 'S'->'a', where 'a' is a proxy for ' ' or '.'
0xd8e57d67,0,0,0,0,0,0,0,0,0x6c74a409,0,0,0x9fa1ded3,0,0xa5595115,0x6266d6f2,0x7005b724 // 'b'->'r'
},
{ 0x4c2b3a57,0,0,0,0,0,0,0,0,0xe44b3c46,0,0,0x0e84bdd8,0,0xf6b29a58,0x45cccd8c,0x6229393a, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x7a4842c1,
0xcaae7de6,0,0,0,0,0,0,0,0,0xcfea4a27,0,0,0x8765a857,0,0x7adfc8ae,0x916b5e58,0x648d8b51 // 'b'->'r'
},
{ 0xecf3e6a5,0,0,0,0,0,0,0,0,0xd6094219,0,0,0x122f6b4d,0,0x565f9848,0x164e1b09,0xa5ee9794, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x052d0873,
0x5e4513d0,0,0,0,0,0,0,0,0,0xd52692f3,0,0,0xf5081ec5,0,0xc73547fe,0x23ee074f,0xdeb91daf // 'b'->'r'
},
{ 0xdebe09c0,0,0,0,0,0,0,0,0,0xfa86bb52,0,0,0x793e6063,0,0xcc95a7d8,0xcd087cb1,0x762382f3, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x853e031d,
0xc7d0c293,0,0,0,0,0,0,0,0,0xadcb0c93,0,0,0x1e473b8e,0,0xb87b61a7,0xa3d1dd20,0x94ff3fc1 // 'b'->'r'
},
{ 0x24b2cd09,0,0,0,0,0,0,0,0,0x89914ab9,0,0,0xf1d5d27f,0,0xc234a220,0x8597da1f,0x1b1cc2ca, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x6a2748f4,
0x793de097,0,0,0,0,0,0,0,0,0x43b9eaa3,0,0,0x2fb379fe,0,0xc6342dcb,0xbca6ab72,0x74c644b7 // 'b'->'r'
},
{ 0x376fd81c,0,0,0,0,0,0,0,0,0x9184e322,0,0,0x229da880,0,0x04cf6880,0x52fae7a4,0x9e1d5c35, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x26511785,
0x9cb24e26,0,0,0,0,0,0,0,0,0x38ea0de8,0,0,0x9def62f4,0,0x62f0f111,0xf199794f,0xe710b184 // 'b'->'r'
},
{ 0xae8bc669,0,0,0,0,0,0,0,0,0x732fec2a,0,0,0x5c08b5ba,0,0x9cf1ba1f,0x6fe15378,0xe7005101, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb297f541,
0x196a6fe7,0,0,0,0,0,0,0,0,0x0f6aefa9,0,0,0xf8456839,0,0xaab13923,0xa7342f66,0xabaeec77 // 'b'->'r'
},
{ 0x2bc0bb0b,0,0,0,0,0,0,0,0,0x35dba1ae,0,0,0x5bafdc52,0,0x2101505b,0xc02cf780,0x50bfe98e, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9b9aca63,
0x5d1c2635,0,0,0,0,0,0,0,0,0x53364b8c,0,0,0x91f86a79,0,0x09d63faa,0x70483054,0xa25fc8cb // 'b'->'r'
},
{ 0xfd061144,0,0,0,0,0,0,0,0,0xf57db306,0,0,0x1a1f9bc4,0,0xa71d442f,0x3578f27f,0xa29337f4, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x294b9483,
0xfecbf3cc,0,0,0,0,0,0,0,0,0xa7321b64,0,0,0x94f424b4,0,0x40d7b7e8,0x6a140f4e,0x7760248f // 'b'->'r'
},
{ 0x7985c694,0,0,0,0,0,0,0,0,0x3e92ace3,0,0,0x9f9e5bba,0,0x28b23b17,0x5687aacf,0x1c418b8d, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xacbc9175,
0xa8053755,0,0,0,0,0,0,0,0,0x51342230,0,0,0x235ff531,0,0xc741a645,0x325338a9,0xf31716a3 // 'b'->'r'
},
{ 0x5e64c5c0,0,0,0,0,0,0,0,0,0xa99b5c5f,0,0,0xd22c9cc5,0,0x03796e5e,0x18dba100,0x9f72d771, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xd6838eb2,
0xac74f524,0,0,0,0,0,0,0,0,0x1899e7a2,0,0,0xf8d16330,0,0xf9f93f5d,0xe0d14983,0x77f98662 // 'b'->'r'
},
{ 0x8276be2a,0,0,0,0,0,0,0,0,0xfa0d03cd,0,0,0x0e435170,0,0x9ad727e7,0x737f2b95,0xbd4060c9, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x051de97f,
0x0a083600,0,0,0,0,0,0,0,0,0x7113f78a,0,0,0x48660972,0,0xfac6322b,0x1ec533ba,0x5c048d7f // 'b'->'r'
},
{ 0x4bcfd817,0,0,0,0,0,0,0,0,0x7b1bd6bb,0,0,0x1e64f082,0,0xb04c1979,0x51675862,0xe166de3e, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x6a0d23a3,
0xeb117ade,0,0,0,0,0,0,0,0,0x106bf87b,0,0,0x3781a7c3,0,0xb145da52,0x90b037ae,0x910ccae3 // 'b'->'r'
},
{ 0xdd775c94,0,0,0,0,0,0,0,0,0x43f090d1,0,0,0x824bca32,0,0x85f3959b,0xeaae5b0e,0x180c7c29, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xebd0fc3a,
0x93713ac1,0,0,0,0,0,0,0,0,0x1546dc24,0,0,0xede65b0a,0,0x47189056,0x518dbc2b,0x02653368 // 'b'->'r'
},
{ 0xaadb680b,0,0,0,0,0,0,0,0,0xd7a3bb02,0,0,0x21bd8133,0,0xa5ad3450,0xb7613820,0xd76514b6, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x4a168480,
0x43c55b26,0,0,0,0,0,0,0,0,0x2ee5a113,0,0,0x65d794ae,0,0x9625b62a,0x8d85b573,0x0525c4b8 // 'b'->'r'
},
{ 0x2a3989bc,0,0,0,0,0,0,0,0,0xd43569e8,0,0,0x5eabbe4d,0,0x0133b91e,0x257d3518,0xad85627d, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x91d28302,
0x451f3e03,0,0,0,0,0,0,0,0,0xb428205e,0,0,0xbc35ace2,0,0x49d9976b,0xf651fd0d,0x6eebf770 // 'b'->'r'
},
{ 0x3fae4928,0,0,0,0,0,0,0,0,0xc1903548,0,0,0x937f0c13,0,0x6566b25f,0x97900f48,0xe562c59a, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x927f19c2,
0xa39054f8,0,0,0,0,0,0,0,0,0x391be0b4,0,0,0xe43ce943,0,0xf3e75bec,0xae181f3d,0x7276cf0e // 'b'->'r'
},
{ 0x72fe9f60,0,0,0,0,0,0,0,0,0xd8ae3d04,0,0,0xfa839fc3,0,0xb31112ed,0x1dbf688b,0x4c24d3fc, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xc45baa56,
0xd0550dcd,0,0,0,0,0,0,0,0,0x696d0b79,0,0,0x6581666d,0,0xace9934b,0xe18ffab8,0x3ff2a610 // 'b'->'r'
},
{ 0x94ce4c98,0,0,0,0,0,0,0,0,0x502f139d,0,0,0xe1b96895,0,0xf725846e,0xb149c019,0x96a5a5d0, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb9aa43bc,
0xa8e00779,0,0,0,0,0,0,0,0,0x8056cb76,0,0,0x88803475,0,0xf4c1e5bd,0x3b043653,0xa4dc8aa1 // 'b'->'r'
},
{ 0x65162768,0,0,0,0,0,0,0,0,0x6c81c3a0,0,0,0x9e6a3ce4,0,0x9b3c95fb,0x7990eafb,0x04e9d879, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x785a9546,
0x4d3401d5,0,0,0,0,0,0,0,0,0xb750a91f,0,0,0xa901220d,0,0x49b9c747,0x4a4286b8,0x622a9498 // 'b'->'r'
},
{ 0x9e36424f,0,0,0,0,0,0,0,0,0xbfc99829,0,0,0x6dc3c912,0,0xe0e23e28,0x22ae6db6,0x1a5540cf, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x4c5c3b0b,
0x17a5d0a6,0,0,0,0,0,0,0,0,0x91e9386f,0,0,0x5aa2cd5d,0,0x97436ff9,0x8d43d481,0x9306fadf // 'b'->'r'
},
{ 0x089ba776,0,0,0,0,0,0,0,0,0xa7382b2c,0,0,0xf80de0d8,0,0xa6f03d7d,0x522ce018,0x6e717043, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x38a4abd2,
0xe58413ef,0,0,0,0,0,0,0,0,0x2429df03,0,0,0x5e1888ea,0,0x18e606cc,0x6f94d7e6,0xfbea3123 // 'b'->'r'
},
{ 0xe45516d6,0,0,0,0,0,0,0,0,0x42a5b3fe,0,0,0xce62babd,0,0x897a4ec5,0xb4320ad7,0x72ab4a2b, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x19a87820,
0x197d5c0b,0,0,0,0,0,0,0,0,0xeb633668,0,0,0x5a3118d4,0,0xb6d8848a,0x7820b6b6,0xffb46feb // 'b'->'r'
},
{ 0xd754f5a5,0,0,0,0,0,0,0,0,0x26423e7d,0,0,0xe796fe9c,0,0xde3d826f,0x099d7de8,0x29992302, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x8220f61b,
0x9d954fd3,0,0,0,0,0,0,0,0,0x2ab684d9,0,0,0x1fb2aa97,0,0xc76fe335,0xd9171133,0xdd6c44ae // 'b'->'r'
},
{ 0xceac7494,0,0,0,0,0,0,0,0,0x69514bb5,0,0,0x91b0961d,0,0x23d53e43,0x683d2a23,0x08814327, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x11b4ed89,
0xfb8a0849,0,0,0,0,0,0,0,0,0xb28ab129,0,0,0x5f8ffb97,0,0x741b5f83,0x6b8a0f2e,0xb8d8a2da // 'b'->'r'
},
{ 0x0cf357b2,0,0,0,0,0,0,0,0,0xddcb3b6c,0,0,0x5d912703,0,0xf9bbc71f,0x0441bb09,0xdb15ed8a, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3b11ee1b,
0x02ffb1ad,0,0,0,0,0,0,0,0,0xc3d140c7,0,0,0x5c2785a7,0,0xf1b2143d,0xbae0a955,0xbffff361 // 'b'->'r'
},
{ 0x2befec2c,0,0,0,0,0,0,0,0,0x56e32b22,0,0,0x8562a7a2,0,0x7d531458,0x0de91821,0x56c7ba85, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3332f8e8,
0x2df312ff,0,0,0,0,0,0,0,0,0x04bdd824,0,0,0x2bc5c700,0,0xcb2fc5cb,0x76a4b922,0x395320c5 // 'b'->'r'
},
{ 0xdfe4037e,0,0,0,0,0,0,0,0,0x5868f7b5,0,0,0xf1b1d4fe,0,0xed96bc50,0x9bb675be,0xb4548088, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x98be68bd,
0x08269881,0,0,0,0,0,0,0,0,0xc89ce8d1,0,0,0x2a296570,0,0x8001b923,0x9f193578,0x0ce50d5b // 'b'->'r'
},
{ 0x93c540a8,0,0,0,0,0,0,0,0,0xb2f81774,0,0,0x3ce68b24,0,0xfe0db0b0,0xef28a619,0x446b5143, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9d2cdf67,
0xadd8e1fc,0,0,0,0,0,0,0,0,0x891f3b23,0,0,0xdd418c72,0,0x9704571e,0xc037541d,0xbae946f1 // 'b'->'r'
},
{ 0xf6e8cd21,0,0,0,0,0,0,0,0,0x4fdba092,0,0,0x8de2d511,0,0x65f1d0dd,0x365f3954,0x35b851fd, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x38f20a02,
0x2faa5845,0,0,0,0,0,0,0,0,0x37fff565,0,0,0xf1c2638c,0,0x91cf922c,0xbd533375,0x73bd6afd // 'b'->'r'
},
{ 0x7d8eb542,0,0,0,0,0,0,0,0,0xf8616e6f,0,0,0x3a37d85b,0,0xae382d55,0x411d81a7,0x15d5ee27, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x0edaffcb,
0x0e716e96,0,0,0,0,0,0,0,0,0x6f35ed9e,0,0,0x7ce2ee91,0,0x4fd1dac6,0xe18983c7,0xb2439112 // 'b'->'r'
},
{ 0xf9f5a35c,0,0,0,0,0,0,0,0,0x60b4582b,0,0,0x9e1ed453,0,0x2dfa81b1,0x8ae13329,0x0651585d, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xdac7f4ae,
0x11374595,0,0,0,0,0,0,0,0,0xbe6bf0c9,0,0,0xadecaf59,0,0x7a8549f2,0x742579e0,0xad5537db // 'b'->'r'
},
{ 0x895d4149,0,0,0,0,0,0,0,0,0x9b674e1c,0,0,0xe58c3feb,0,0xb6f660d1,0xfd86da69,0x7830f7ba, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x37868f80,
0x74bd5fd6,0,0,0,0,0,0,0,0,0xa9bf7e3f,0,0,0xe80b0410,0,0x4369186a,0x2320e0a4,0x0549625e // 'b'->'r'
},
{ 0x3aae1e18,0,0,0,0,0,0,0,0,0xc2251a74,0,0,0xe1af94bf,0,0x51eca4c3,0xe7886533,0x622ab088, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa55223b8,
0x969bf35b,0,0,0,0,0,0,0,0,0x531e6c5d,0,0,0xd4bf977b,0,0x850bcaee,0xa104f457,0x0003a0a0 // 'b'->'r'
},
{ 0xdf660893,0,0,0,0,0,0,0,0,0x4fd61248,0,0,0x4606d9c7,0,0x6cea6457,0xcc4ccc0d,0xe2a57d3a, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x2f85d651,
0xae0c9478,0,0,0,0,0,0,0,0,0xf3ea2774,0,0,0x74c4ebb7,0,0xafff3b40,0x7bc0aacb,0x372b82dc // 'b'->'r'
},
{ 0xc9ead3a4,0,0,0,0,0,0,0,0,0xf286e119,0,0,0x3abcb320,0,0xbb195daa,0xe15b2f0e,0x410251d6, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x504e251c,
0x369b9d14,0,0,0,0,0,0,0,0,0xf51b7fd2,0,0,0x84a8cd44,0,0x78c4b616,0x0691d4e3,0xb62a5b7a // 'b'->'r'
},
{ 0x351cc253,0,0,0,0,0,0,0,0,0x27588287,0,0,0x6cb82fc8,0,0xbafe423d,0x5fc99a8d,0xa5719605, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x76ace100,
0x37026c88,0,0,0,0,0,0,0,0,0x4712accf,0,0,0x2fbbb9cf,0,0x96377fb5,0xcebd948b,0xdd25a404 // 'b'->'r'
},
{ 0xbf4099a7,0,0,0,0,0,0,0,0,0x1e16915c,0,0,0xacc2cbad,0,0x8472f51a,0x46e2824a,0x21cf3734, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x2cc6d3ee,
0xb7841db1,0,0,0,0,0,0,0,0,0xb4586cdb,0,0,0x65642b33,0,0x769102e3,0x90bf7369,0xd7265312 // 'b'->'r'
},
{ 0x2eeb6d75,0,0,0,0,0,0,0,0,0x34721522,0,0,0x2514be33,0,0x2a3abe9e,0x7cf141b5,0x1ff50f3a, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x5b096fab,
0xb8da4737,0,0,0,0,0,0,0,0,0xf0c025fc,0,0,0x07cbc3fc,0,0xc3ec5b12,0xbf3b03ad,0xbfa86b57 // 'b'->'r'
},
{ 0x17b461c1,0,0,0,0,0,0,0,0,0xe75a2d46,0,0,0x37aad5ea,0,0x155b2c35,0xbfcf2330,0x8d5c7c5e, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xbb50483b,
0x95a03950,0,0,0,0,0,0,0,0,0x0bad669a,0,0,0xf641767c,0,0x358b50a3,0x4aca2e3a,0x497343b1 // 'b'->'r'
},
{ 0x3da6f46a,0,0,0,0,0,0,0,0,0xad6120c9,0,0,0x19acdd2c,0,0x1023470d,0x0434bb79,0x8e3f0746, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xedf5a226,
0x025d8ea7,0,0,0,0,0,0,0,0,0xab7fa688,0,0,0xd541fc0d,0,0xc8ffc7f8,0xfbfd0387,0x481f76d0 // 'b'->'r'
},
{ 0xb4183bf8,0,0,0,0,0,0,0,0,0x961efa16,0,0,0x2e7f61f8,0,0x105f5f4f,0x832c37d9,0x7c521708, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x94982ee3,
0xfa3d1f06,0,0,0,0,0,0,0,0,0xc99c5cd1,0,0,0xe062a5c7,0,0x9b41f9d4,0x569195d9,0x37e93fc2 // 'b'->'r'
},
{ 0xf629763c,0,0,0,0,0,0,0,0,0x7485f190,0,0,0x3b50cc38,0,0xe0fd9b72,0xf3068eed,0x7e054a97, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xf0fe2118,
0xb72f0404,0,0,0,0,0,0,0,0,0xcc988a64,0,0,0x7c74f3ec,0,0xa1650931,0xb5636957,0xdfd1561e // 'b'->'r'
},
{ 0x7f861e36,0,0,0,0,0,0,0,0,0x4b036099,0,0,0xd8346f14,0,0xd9545d61,0x31c06965,0x9e2d2ab9, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xc5f8b197,
0x03637d9b,0,0,0,0,0,0,0,0,0xf969041d,0,0,0x58e44ba1,0,0xdcc05573,0x25ec8f35,0xc7ca0a77 // 'b'->'r'
},
{ 0xfb592bb3,0,0,0,0,0,0,0,0,0xfc2b1356,0,0,0x7a7679f6,0,0xc0e9f007,0x7f550a69,0x01094bf1, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa3b47889,
0x44fc9ab6,0,0,0,0,0,0,0,0,0x5e5b8f80,0,0,0x69160353,0,0x230be578,0x6da013a4,0xd2764ed1 // 'b'->'r'
},
{ 0x4c3f5c94,0,0,0,0,0,0,0,0,0x3099df75,0,0,0x66b09bf0,0,0x82e5cd03,0x1ee3607e,0x396cd72a, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xfb0f2241,
0x190c5614,0,0,0,0,0,0,0,0,0x67f78324,0,0,0xdcb89544,0,0x91b7cbd0,0xf9114070,0x57f687af // 'b'->'r'
},
{ 0xf5f9428a,0,0,0,0,0,0,0,0,0xc9f390ed,0,0,0xe8140568,0,0x694fb3de,0xc627f75b,0x5bf9362b, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x5549003f,
0x66458f9f,0,0,0,0,0,0,0,0,0x14c30f94,0,0,0x4d44c9c6,0,0x6840f509,0xc674cdbc,0x3b73b25b // 'b'->'r'
},
{ 0xed1c4a6f,0,0,0,0,0,0,0,0,0x21eab5a3,0,0,0x53478953,0,0x0dad674c,0xf3ef5512,0xb9c08d71, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x03921f4a,
0x02ece8e2,0,0,0,0,0,0,0,0,0x889134e1,0,0,0xc544c7ab,0,0x4df91683,0x259e4b8c,0xe2031ce4 // 'b'->'r'
},
{ 0x145b8f3a,0,0,0,0,0,0,0,0,0x4028cf81,0,0,0x16f03971,0,0xad6adc80,0xac0b5327,0xcf77f418, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3ed062ba,
0x6ea14124,0,0,0,0,0,0,0,0,0x6ba87963,0,0,0xc08be345,0,0x8eafb886,0xd460d003,0xdc4d14e2 // 'b'->'r'
},
{ 0x61085b79,0,0,0,0,0,0,0,0,0xba1f92a8,0,0,0x18b779bc,0,0x453435a1,0x41925d1c,0x21a8db44, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9789101a,
0x0e2d02e0,0,0,0,0,0,0,0,0,0x79fa68f8,0,0,0x4d35916d,0,0x7ce947b3,0x431a2cc9,0x756135b5 // 'b'->'r'
},
{ 0x74c5a0c5,0,0,0,0,0,0,0,0,0x864bb3a1,0,0,0xaeeb8687,0,0x7127ea7d,0xb214825e,0xda464848, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x4894b0f6,
0x6ef5db54,0,0,0,0,0,0,0,0,0x6142e487,0,0,0xd3adc6c3,0,0x2e5fe8d5,0x82643ddb,0xc9de1e6c // 'b'->'r'
},
{ 0x161ccd43,0,0,0,0,0,0,0,0,0x0e8d9866,0,0,0xa8f85f54,0,0xb26e6947,0x34e36253,0xc75894df, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xd8e70900,
0xc7042e85,0,0,0,0,0,0,0,0,0xae6d8d5b,0,0,0x4269846b,0,0x2da97b9e,0x5fb237c9,0x11e247d3 // 'b'->'r'
},
{ 0x966cee07,0,0,0,0,0,0,0,0,0x027aec95,0,0,0x45d7a7e5,0,0xe45d5ddc,0x5ef03588,0x222ac6ab, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3272262e,
0xc7792000,0,0,0,0,0,0,0,0,0x75b91d68,0,0,0xecd782b3,0,0x0b6bb626,0xb715f459,0xccbf6c4a // 'b'->'r'
},
{ 0x7da649f3,0,0,0,0,0,0,0,0,0x13b36ae2,0,0,0x78310a7b,0,0x84d26157,0xe1f93c60,0x4e8b1b53, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x7d08711a,
0x93d9dace,0,0,0,0,0,0,0,0,0x6a211820,0,0,0xf59d6c73,0,0x2c9299c6,0xa5441761,0x79ac91ac // 'b'->'r'
},
{ 0x090d833b,0,0,0,0,0,0,0,0,0xc89d2739,0,0,0x6e2edab2,0,0x8e7228ad,0x829076e9,0x28ed0c84, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x8942edb9,
0x24d2005d,0,0,0,0,0,0,0,0,0xae6fbd5b,0,0,0xa6433591,0,0x471089a3,0x8a0a8ec2,0x20fd0194 // 'b'->'r'
},
{ 0x536013ad,0,0,0,0,0,0,0,0,0x648664b9,0,0,0x25a2b3cf,0,0xf4d70177,0x28ed3ea4,0x2fe7cf69, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x21212abe,
0xe76b7e04,0,0,0,0,0,0,0,0,0x943441f1,0,0,0x8b36ddf2,0,0x179e5ccd,0x74f8259e,0xe919756d // 'b'->'r'
},
{ 0xe1cd7757,0,0,0,0,0,0,0,0,0x153da2e2,0,0,0x756711a3,0,0xcce59a49,0xb9630cda,0xe08ba7b7, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x6626861a,
0x17ecf576,0,0,0,0,0,0,0,0,0xe76f7416,0,0,0x6d2261cc,0,0xb0a57acf,0x7924fd62,0xb31a6e5a // 'b'->'r'
},
{ 0x9487cc33,0,0,0,0,0,0,0,0,0x53e57be6,0,0,0xb75bc72e,0,0xc1bc3ed0,0x06edfe3d,0xa2d4e5bc, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xbb3cdb2f,
0x3d71f7fa,0,0,0,0,0,0,0,0,0xc457b868,0,0,0x29191280,0,0x02800d8a,0xcbe04fcb,0x4eebd78d // 'b'->'r'
},
{ 0xf58bf147,0,0,0,0,0,0,0,0,0x3b9d125e,0,0,0x75489606,0,0x80e09ead,0x974abcf5,0xf427159e, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xdb93b60f,
0x8eccb8a9,0,0,0,0,0,0,0,0,0x750c98a6,0,0,0x18f3b535,0,0xf3ae0bab,0x9f265252,0x93646d87 // 'b'->'r'
},
{ 0xdcef0cdc,0,0,0,0,0,0,0,0,0xd21dcb41,0,0,0x285a96a9,0,0xe8a9fb42,0xfe0fdc72,0xd0c62b5c, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x15c2a14e,
0x28cf62e5,0,0,0,0,0,0,0,0,0x182e64db,0,0,0xa0ff7cf6,0,0xa2342064,0x65ffc99f,0xf30528dd // 'b'->'r'
},
{ 0x100df4b2,0,0,0,0,0,0,0,0,0xefce9dfc,0,0,0x6c8d60ae,0,0x7287625d,0x42391e72,0xba4a4ea1, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xd95a930c,
0xbe034ee0,0,0,0,0,0,0,0,0,0x0886a6e9,0,0,0x4e96a350,0,0xf57fe442,0x1ea955c8,0x5af973f3 // 'b'->'r'
},
{ 0x71a2087d,0,0,0,0,0,0,0,0,0x5b51248a,0,0,0x644b5270,0,0x042e1ada,0x8827449b,0x2f6b62b8, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xd8695c78,
0x66b8f141,0,0,0,0,0,0,0,0,0x894949c0,0,0,0xede60ac5,0,0xae262f58,0x19805d22,0x9bf30fcf // 'b'->'r'
},
{ 0xf1ff4803,0,0,0,0,0,0,0,0,0x1935dabc,0,0,0xde96ccee,0,0x178f1ea5,0x7443fcab,0x0e53c6d3, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x53a2ab58,
0x1626fe46,0,0,0,0,0,0,0,0,0x3b951e94,0,0,0x3cb76386,0,0x9d4d8f1c,0xd6ea5273,0x08779386 // 'b'->'r'
},
{ 0x85ba1342,0,0,0,0,0,0,0,0,0x03fec25c,0,0,0x8358dfdc,0,0x6dc58e66,0xa65b6365,0x116d4d7b, // 'B'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x8b6a4ec5,
0x407f346d,0,0,0,0,0,0,0,0,0x084fa549,0,0,0x389e0064,0,0x9484d2b6,0x40d1234d,0xc5661795 // 'b'->'r'
}
};
static uint64_t hash64_lookup[64]['r'-'B'+1] =
{
{ 0x218cd5fb8c7f0aac,0,0,0,0,0,0,0,0,0x6050629f97c4aa2f,0,0, // 'B'->'K'+2
0x0314ce51b716a675,0,0x7db3cc23d821ccc0,0x1d9060ed9a4eb343,0xfb4cbcf3dba252fb, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9e54b8fa8b7d76c3, // 'S'->'a', where 'a' is a proxy for ' ' or '.'
0x3ea17988d8e57d67,0,0,0,0,0,0,0,0,0xf968dafe6c74a409,0,0, // 'b'->'k'+2
0x5fd3a5199fa1ded3,0,0xfd874015a5595115,0x0bb059ad6266d6f2,0x68b7c4e57005b724 // 'n'->'r'
},
{ 0x4f6097d64c2b3a57,0,0,0,0,0,0,0,0,0x29b76190e44b3c46,0,0, // 'B'->'K'+2
0xd4de74990e84bdd8,0,0xa385e3eef6b29a58,0xce990c7745cccd8c,0x7d84a6a56229393a, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa3d89f7f7a4842c1,
0xfd49f581caae7de6,0,0,0,0,0,0,0,0,0x5e3bf585cfea4a27,0,0, // 'b'->'k'+2
0x10b7c6c68765a857,0,0x5010998c7adfc8ae,0xc8820d5a916b5e58,0xcd45224a648d8b51 // 'n'->'r'
},
{ 0x49d47bfbecf3e6a5,0,0,0,0,0,0,0,0,0x1208d3b6d6094219,0,0, // 'B'->'K'+2
0x3dcd9c4e122f6b4d,0,0xaefea33e565f9848,0xa999e648164e1b09,0x617778c7a5ee9794, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3efdff2d052d0873,
0xa2494c855e4513d0,0,0,0,0,0,0,0,0,0xaa75be2fd52692f3,0,0, // 'b'->'k'+2
0xed47f2bbf5081ec5,0,0x846e54aac73547fe,0xda9bd1c323ee074f,0x6c91188adeb91daf // 'n'->'r'
},
{ 0x7f67d2f2debe09c0,0,0,0,0,0,0,0,0,0x8e000539fa86bb52,0,0, // 'B'->'K'+2
0x6d868ddb793e6063,0,0x497c3559cc95a7d8,0xd2934183cd087cb1,0xb4e2147d762382f3, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xbcfc6ace853e031d,
0x6a340f52c7d0c293,0,0,0,0,0,0,0,0,0x727804c5adcb0c93,0,0, // 'b'->'k'+2
0x5c4cb6ba1e473b8e,0,0xf80a0784b87b61a7,0xd422dc11a3d1dd20,0x5cf822c594ff3fc1 // 'n'->'r'
},
{ 0xeccaa1bf24b2cd09,0,0,0,0,0,0,0,0,0x65c4c15e89914ab9,0,0, // 'B'->'K'+2
0x0bc72298f1d5d27f,0,0xbd1a4e83c234a220,0x3b8d71458597da1f,0x72f721a81b1cc2ca, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x593890a46a2748f4,
0xeff1de3a793de097,0,0,0,0,0,0,0,0,0xd0a1a4b143b9eaa3,0,0, // 'b'->'k'+2
0x41da0db72fb379fe,0,0xfc492a98c6342dcb,0x61bb02a1bca6ab72,0xf80e879274c644b7 // 'n'->'r'
},
{ 0xb277df61376fd81c,0,0,0,0,0,0,0,0,0xe7aab1ce9184e322,0,0, // 'B'->'K'+2
0xe5a662f1229da880,0,0x4beb1c8704cf6880,0x1efdc7b552fae7a4,0xfdf472eb9e1d5c35, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x3dd5f02e26511785,
0x3fd9fdf09cb24e26,0,0,0,0,0,0,0,0,0x3a6f7bf438ea0de8,0,0, // 'b'->'k'+2
0x1b1caa7f9def62f4,0,0x7d507ba162f0f111,0xf371a151f199794f,0xe43ad49de710b184 // 'n'->'r'
},
{ 0x3bc16e0cae8bc669,0,0,0,0,0,0,0,0,0x5bacee76732fec2a,0,0, // 'B'->'K'+2
0xb094a72e5c08b5ba,0,0x629eeb769cf1ba1f,0x0ef071206fe15378,0xeaae9f22e7005101, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xbb0fc073b297f541,
0x1d231657196a6fe7,0,0,0,0,0,0,0,0,0xe1b86a7c0f6aefa9,0,0, // 'b'->'k'+2
0xa1917199f8456839,0,0x45be6caeaab13923,0x220029f2a7342f66,0x6109df6babaeec77 // 'n'->'r'
},
{ 0x5fce7e342bc0bb0b,0,0,0,0,0,0,0,0,0x5fd1dfe935dba1ae,0,0, // 'B'->'K'+2
0x530c326e5bafdc52,0,0xbfb096402101505b,0xae1c0d4cc02cf780,0x3ce0ef7650bfe98e, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xcba82a499b9aca63,
0x2bfe90925d1c2635,0,0,0,0,0,0,0,0,0x8101cb0453364b8c,0,0, // 'b'->'k'+2
0x7304c70791f86a79,0,0x4bd68a8309d63faa,0x4df1a43070483054,0xe2ce6c4ca25fc8cb // 'n'->'r'
},
{ 0xd6d51925fd061144,0,0,0,0,0,0,0,0,0x5a143074f57db306,0,0, // 'B'->'K'+2
0x3cdca5ed1a1f9bc4,0,0xbd072630a71d442f,0x809c986d3578f27f,0x8e2c27d2a29337f4, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xf14d28b3294b9483,
0x3396aa31fecbf3cc,0,0,0,0,0,0,0,0,0xa24dac47a7321b64,0,0, // 'b'->'k'+2
0x8c6bbf5a94f424b4,0,0xde06adb140d7b7e8,0x85074fee6a140f4e,0xf0b1951d7760248f // 'n'->'r'
},
{ 0x5949d2037985c694,0,0,0,0,0,0,0,0,0xc032204a3e92ace3,0,0, // 'B'->'K'+2
0x064d7e549f9e5bba,0,0xb31759ea28b23b17,0x2619ad415687aacf,0xf7cc97771c418b8d, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x21c10e14acbc9175,
0xfe910cd0a8053755,0,0,0,0,0,0,0,0,0xb53a142a51342230,0,0, // 'b'->'k'+2
0x73aa95f2235ff531,0,0xb585c01cc741a645,0x1224859a325338a9,0x9c9b8b57f31716a3 // 'n'->'r'
},
{ 0x4af48cb45e64c5c0,0,0,0,0,0,0,0,0,0xac021930a99b5c5f,0,0, // 'B'->'K'+2
0x2700b7c2d22c9cc5,0,0x7290666603796e5e,0x6ae0630918dba100,0xb2321d029f72d771, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x219c2d74d6838eb2,
0x60d9fb6cac74f524,0,0,0,0,0,0,0,0,0x9aa776e91899e7a2,0,0, // 'b'->'k'+2
0x199bb359f8d16330,0,0x61ffb57cf9f93f5d,0xf5d36375e0d14983,0xe538026477f98662 // 'n'->'r'
},
{ 0x128b105a8276be2a,0,0,0,0,0,0,0,0,0xf7c16444fa0d03cd,0,0, // 'B'->'K'+2
0x04f0e2690e435170,0,0x8c00a60a9ad727e7,0xfac5500c737f2b95,0x465ad668bd4060c9, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x2602a8e1051de97f,
0x979c69a50a083600,0,0,0,0,0,0,0,0,0x423a50a77113f78a,0,0, // 'b'->'k'+2
0xe59223a048660972,0,0x372ce57afac6322b,0x681fad211ec533ba,0x9475239a5c048d7f // 'n'->'r'
},
{ 0x8d5500634bcfd817,0,0,0,0,0,0,0,0,0xf9cadcd97b1bd6bb,0,0, // 'B'->'K'+2
0x458b09321e64f082,0,0x45e3e958b04c1979,0x7497fcd251675862,0xf856d714e166de3e, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x66d6b2de6a0d23a3,
0x0686fe9ceb117ade,0,0,0,0,0,0,0,0,0x3f980648106bf87b,0,0, // 'b'->'k'+2
0xe356d5123781a7c3,0,0x81807599b145da52,0xb567639890b037ae,0x4f751e27910ccae3 // 'n'->'r'
},
{ 0x471c2ceadd775c94,0,0,0,0,0,0,0,0,0x5f7f367b43f090d1,0,0, // 'B'->'K'+2
0xe515c11c824bca32,0,0x8664769885f3959b,0x06ca2e92eaae5b0e,0xc026fec3180c7c29, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa029b8acebd0fc3a,
0x5560bed393713ac1,0,0,0,0,0,0,0,0,0x545ce92d1546dc24,0,0, // 'b'->'k'+2
0xec95ab36ede65b0a,0,0xf795400047189056,0xdcc0e88a518dbc2b,0x2b27d2c302653368 // 'n'->'r'
},
{ 0x0c76f786aadb680b,0,0,0,0,0,0,0,0,0xe6c796dbd7a3bb02,0,0, // 'B'->'K'+2
0x40eeb76321bd8133,0,0x5476a9b9a5ad3450,0x7235efc6b7613820,0xe3a4cb93d76514b6, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x1ac8e4a24a168480,
0x8330083243c55b26,0,0,0,0,0,0,0,0,0x5935b8f22ee5a113,0,0, // 'b'->'k'+2
0x82b8936665d794ae,0,0xbd7708149625b62a,0x63071aab8d85b573,0xae3632760525c4b8 // 'n'->'r'
},
{ 0x87b3e8802a3989bc,0,0,0,0,0,0,0,0,0x9f5495e4d43569e8,0,0, // 'B'->'K'+2
0xf1d8596d5eabbe4d,0,0xb5e530690133b91e,0xe4929ec2257d3518,0x3475e0e1ad85627d, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xad575e8c91d28302,
0x5779870f451f3e03,0,0,0,0,0,0,0,0,0xa3974c76b428205e,0,0, // 'b'->'k'+2
0xad1e3a21bc35ace2,0,0x8c61689749d9976b,0xe115878cf651fd0d,0x45ce8f856eebf770 // 'n'->'r'
},
{ 0x8b2e7c263fae4928,0,0,0,0,0,0,0,0,0x25f4ef01c1903548,0,0, // 'B'->'K'+2
0x485f010a937f0c13,0,0xdb36ac066566b25f,0x07bd7f7d97900f48,0xa2931506e562c59a, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb5d8a266927f19c2,
0x4cb56fa6a39054f8,0,0,0,0,0,0,0,0,0x0204b14b391be0b4,0,0, // 'b'->'k'+2
0x75d0f572e43ce943,0,0x5f67e555f3e75bec,0x06476d7eae181f3d,0x87d149727276cf0e // 'n'->'r'
},
{ 0x8edd5ab272fe9f60,0,0,0,0,0,0,0,0,0xec0f7f33d8ae3d04,0,0, // 'B'->'K'+2
0x5c746d02fa839fc3,0,0x16e91d4cb31112ed,0x80b1929d1dbf688b,0x67ebd6094c24d3fc, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x27542273c45baa56,
0x063963c8d0550dcd,0,0,0,0,0,0,0,0,0x6cee1185696d0b79,0,0, // 'b'->'k'+2
0x57b55a746581666d,0,0xe7fae0b5ace9934b,0x9f4a88ebe18ffab8,0x022dd0c13ff2a610 // 'n'->'r'
},
{ 0x4770ff2b94ce4c98,0,0,0,0,0,0,0,0,0xf8077a4f502f139d,0,0, // 'B'->'K'+2
0x35b22c3ee1b96895,0,0xb0de694cf725846e,0x1d9eba2fb149c019,0x19735a4c96a5a5d0, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x93bf7695b9aa43bc,
0x4a2ec078a8e00779,0,0,0,0,0,0,0,0,0xb1fd37128056cb76,0,0, // 'b'->'k'+2
0x8a00b95988803475,0,0xac05620df4c1e5bd,0xb961c0de3b043653,0xf2e88e5ca4dc8aa1 // 'n'->'r'
},
{ 0x638cd0ec65162768,0,0,0,0,0,0,0,0,0x00b128696c81c3a0,0,0, // 'B'->'K'+2
0x3a222cd59e6a3ce4,0,0xa5aeae069b3c95fb,0x7471b2647990eafb,0x99b34e3004e9d879, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xf8da6628785a9546,
0x96b7a39a4d3401d5,0,0,0,0,0,0,0,0,0xd5751c9eb750a91f,0,0, // 'b'->'k'+2
0xf6781d85a901220d,0,0xea2fb88f49b9c747,0x0451b3bf4a4286b8,0xaad32de5622a9498 // 'n'->'r'
},
{ 0xb24cac259e36424f,0,0,0,0,0,0,0,0,0x70cf7e3bbfc99829,0,0, // 'B'->'K'+2
0xd04d3e716dc3c912,0,0xaf62305fe0e23e28,0x8282b96022ae6db6,0xa60a89f01a5540cf, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x557eb8d04c5c3b0b,
0x0773192017a5d0a6,0,0,0,0,0,0,0,0,0xca74803e91e9386f,0,0, // 'b'->'k'+2
0xeb66698a5aa2cd5d,0,0x18e4e98c97436ff9,0x8ade765d8d43d481,0x71293f409306fadf // 'n'->'r'
},
{ 0xfdbb759d089ba776,0,0,0,0,0,0,0,0,0x851b995aa7382b2c,0,0, // 'B'->'K'+2
0x621307e7f80de0d8,0,0xb1a72096a6f03d7d,0xce81e193522ce018,0x174449856e717043, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x76048b2438a4abd2,
0x3a4e7253e58413ef,0,0,0,0,0,0,0,0,0xd3aac07f2429df03,0,0, // 'b'->'k'+2
0x690985e45e1888ea,0,0x8a03a70518e606cc,0x9f903d5c6f94d7e6,0xe323c9ccfbea3123 // 'n'->'r'
},
{ 0xe30fdc9ae45516d6,0,0,0,0,0,0,0,0,0xe14eaef142a5b3fe,0,0, // 'B'->'K'+2
0x9e6b6453ce62babd,0,0x540baf8c897a4ec5,0x222a87e6b4320ad7,0x6788648772ab4a2b, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xfb074cb419a87820,
0x8b6e0250197d5c0b,0,0,0,0,0,0,0,0,0xdf2d599deb633668,0,0, // 'b'->'k'+2
0x9f2744005a3118d4,0,0x80b24ed7b6d8848a,0x611d7acf7820b6b6,0xec1eff4affb46feb // 'n'->'r'
},
{ 0x8ac8fefcd754f5a5,0,0,0,0,0,0,0,0,0x8a97ee8326423e7d,0,0, // 'B'->'K'+2
0x1ef4923de796fe9c,0,0xec5dc943de3d826f,0xae422c90099d7de8,0xd474277029992302, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x4980a5c98220f61b,
0xf7e19e549d954fd3,0,0,0,0,0,0,0,0,0x0b0080742ab684d9,0,0, // 'b'->'k'+2
0xeb76e2e51fb2aa97,0,0x1db89effc76fe335,0x09398338d9171133,0x1b3ef53edd6c44ae // 'n'->'r'
},
{ 0x2cbddbb8ceac7494,0,0,0,0,0,0,0,0,0x51055a3069514bb5,0,0, // 'B'->'K'+2
0x639e549191b0961d,0,0x3f1ce77523d53e43,0xf3bf9fb9683d2a23,0x90128e0908814327, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x4cceb1ec11b4ed89,
0xe806d4befb8a0849,0,0,0,0,0,0,0,0,0x2914684fb28ab129,0,0, // 'b'->'k'+2
0x9481e2e65f8ffb97,0,0xe2e4dcce741b5f83,0x991261a16b8a0f2e,0x7246e784b8d8a2da // 'n'->'r'
},
{ 0x3cf06b900cf357b2,0,0,0,0,0,0,0,0,0xe86a88e4ddcb3b6c,0,0, // 'B'->'K'+2
0x94b507475d912703,0,0x2904dd3ef9bbc71f,0x2557bf170441bb09,0xa93eff5bdb15ed8a, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x55ebe96e3b11ee1b,
0x70b5200702ffb1ad,0,0,0,0,0,0,0,0,0xa02299fdc3d140c7,0,0, // 'b'->'k'+2
0x1394a3165c2785a7,0,0x5c7e8762f1b2143d,0xb24b689ebae0a955,0xe936e6f6bffff361 // 'n'->'r'
},
{ 0x3f5586502befec2c,0,0,0,0,0,0,0,0,0xe0e4e49b56e32b22,0,0, // 'B'->'K'+2
0x0a243e2f8562a7a2,0,0x6f24d1ef7d531458,0x0f5882720de91821,0x84823a0b56c7ba85, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x0fa2d7d73332f8e8,
0x7983d74e2df312ff,0,0,0,0,0,0,0,0,0xe8612fe704bdd824,0,0, // 'b'->'k'+2
0x2f32631e2bc5c700,0,0xbd69085acb2fc5cb,0x6f4c792276a4b922,0xe5e76a36395320c5 // 'n'->'r'
},
{ 0x30036751dfe4037e,0,0,0,0,0,0,0,0,0xac2e5aa35868f7b5,0,0, // 'B'->'K'+2
0xb717dc47f1b1d4fe,0,0x87689b6ded96bc50,0x85e3bf3b9bb675be,0x4df03270b4548088, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x521091a598be68bd,
0xff7a744408269881,0,0,0,0,0,0,0,0,0x00cb21b5c89ce8d1,0,0, // 'b'->'k'+2
0x5cb86c0d2a296570,0,0x98e8d8658001b923,0x787c73139f193578,0xa629ff6b0ce50d5b // 'n'->'r'
},
{ 0x60d4ad0893c540a8,0,0,0,0,0,0,0,0,0x01541b60b2f81774,0,0, // 'B'->'K'+2
0xfac246d13ce68b24,0,0xf86074c5fe0db0b0,0x2cb6697cef28a619,0xa9f32064446b5143, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x53f705819d2cdf67,
0x4b0b82fdadd8e1fc,0,0,0,0,0,0,0,0,0xae2b549d891f3b23,0,0, // 'b'->'k'+2
0x334b1385dd418c72,0,0x102e5fd09704571e,0xecfad0e6c037541d,0x9b74b1f8bae946f1 // 'n'->'r'
},
{ 0x4f2b17a8f6e8cd21,0,0,0,0,0,0,0,0,0x7a470a964fdba092,0,0, // 'B'->'K'+2
0x67394c1e8de2d511,0,0x48b438ff65f1d0dd,0xa2105a13365f3954,0x3d08a70435b851fd, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe401d29438f20a02,
0x83b71b6a2faa5845,0,0,0,0,0,0,0,0,0x6ebf4a4a37fff565,0,0, // 'b'->'k'+2
0x5e30807bf1c2638c,0,0xed9fbdc391cf922c,0x74de7cd6bd533375,0x9792993c73bd6afd // 'n'->'r'
},
{ 0x5664eae57d8eb542,0,0,0,0,0,0,0,0,0x6e8974faf8616e6f,0,0, // 'B'->'K'+2
0xf872465d3a37d85b,0,0x97c072a9ae382d55,0x22291628411d81a7,0x5ac0e8bc15d5ee27, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x18c824d10edaffcb,
0xa83272b30e716e96,0,0,0,0,0,0,0,0,0x57e885286f35ed9e,0,0, // 'b'->'k'+2
0xa6fdb83b7ce2ee91,0,0x974d89ea4fd1dac6,0xd25c25dee18983c7,0xa8bfca1db2439112 // 'n'->'r'
},
{ 0x671bb8e1f9f5a35c,0,0,0,0,0,0,0,0,0x65b29e5e60b4582b,0,0, // 'B'->'K'+2
0x099ddcee9e1ed453,0,0xffd0aea52dfa81b1,0xfc10d17e8ae13329,0x5a15a8d80651585d, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x72b97d10dac7f4ae,
0xb8ae1b6311374595,0,0,0,0,0,0,0,0,0xf008dca7be6bf0c9,0,0, // 'b'->'k'+2
0xa3389e9dadecaf59,0,0xac0ae1fc7a8549f2,0xd0244c41742579e0,0x44463f17ad5537db // 'n'->'r'
},
{ 0xf9e9ecc8895d4149,0,0,0,0,0,0,0,0,0x906685809b674e1c,0,0, // 'B'->'K'+2
0xe3c98457e58c3feb,0,0xf4f98f25b6f660d1,0xc3ba556ffd86da69,0x1d0d69bf7830f7ba, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb2c0699a37868f80,
0x45b0d2d974bd5fd6,0,0,0,0,0,0,0,0,0x55e33559a9bf7e3f,0,0, // 'b'->'k'+2
0x1501bc86e80b0410,0,0x25ceb8d84369186a,0xc3e8c5f72320e0a4,0x1008e9cf0549625e // 'n'->'r'
},
{ 0x058d64653aae1e18,0,0,0,0,0,0,0,0,0x3ded4529c2251a74,0,0, // 'B'->'K'+2
0x2322e791e1af94bf,0,0x6ea9ffd051eca4c3,0x42b88f70e7886533,0x85a18c2b622ab088, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xdeff446ea55223b8,
0xc5e8cdc5969bf35b,0,0,0,0,0,0,0,0,0x2dedd176531e6c5d,0,0, // 'b'->'k'+2
0xf5700b93d4bf977b,0,0x6eeb5aef850bcaee,0x1e08b716a104f457,0x533aed6d0003a0a0 // 'n'->'r'
},
{ 0x1b649f8bdf660893,0,0,0,0,0,0,0,0,0x9559fa0b4fd61248,0,0, // 'B'->'K'+2
0x96f63ba14606d9c7,0,0xefbc5f876cea6457,0xbed26877cc4ccc0d,0xf0d7111ae2a57d3a, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xd92062302f85d651,
0x0d712cc7ae0c9478,0,0,0,0,0,0,0,0,0xef92b0eff3ea2774,0,0, // 'b'->'k'+2
0x98a14ab674c4ebb7,0,0xfbc1d260afff3b40,0xe44d11647bc0aacb,0x66596752372b82dc // 'n'->'r'
},
{ 0xc7eb1a57c9ead3a4,0,0,0,0,0,0,0,0,0x615da595f286e119,0,0, // 'B'->'K'+2
0x362715fe3abcb320,0,0x25d6ca02bb195daa,0xc3d6ad08e15b2f0e,0xaf57dd0a410251d6, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x30666905504e251c,
0xa8218d26369b9d14,0,0,0,0,0,0,0,0,0xe6151ba6f51b7fd2,0,0, // 'b'->'k'+2
0xdcb0226484a8cd44,0,0x024951c178c4b616,0x18e5e6750691d4e3,0x1719823bb62a5b7a // 'n'->'r'
},
{ 0x7f6e4ea4351cc253,0,0,0,0,0,0,0,0,0x9e82c38527588287,0,0, // 'B'->'K'+2
0x94c1c9056cb82fc8,0,0x61e79826bafe423d,0x3dd6aea35fc99a8d,0x18b85858a5719605, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x2b453fb176ace100,
0xfc2496cf37026c88,0,0,0,0,0,0,0,0,0xdc0d7d544712accf,0,0, // 'b'->'k'+2
0xe58659722fbbb9cf,0,0x0efc250996377fb5,0x4567aff7cebd948b,0x787a9c84dd25a404 // 'n'->'r'
},
{ 0x7922fbb1bf4099a7,0,0,0,0,0,0,0,0,0x1da74c181e16915c,0,0, // 'B'->'K'+2
0x7ad1265eacc2cbad,0,0x7501cd828472f51a,0x8225df5346e2824a,0xfadecf8321cf3734, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xf79e4e4d2cc6d3ee,
0x6c78050bb7841db1,0,0,0,0,0,0,0,0,0x1996e18db4586cdb,0,0, // 'b'->'k'+2
0xdb6c89e465642b33,0,0x0a268851769102e3,0x1e08649a90bf7369,0x7bd42fc6d7265312 // 'n'->'r'
},
{ 0x4570c6af2eeb6d75,0,0,0,0,0,0,0,0,0x7550766234721522,0,0, // 'B'->'K'+2
0x675ef6152514be33,0,0x3c3a2f942a3abe9e,0x665a16aa7cf141b5,0x0f121f7a1ff50f3a, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xabdfc9b95b096fab,
0x1fb44491b8da4737,0,0,0,0,0,0,0,0,0x583f7265f0c025fc,0,0, // 'b'->'k'+2
0xdb544fd907cbc3fc,0,0xb6b96cf4c3ec5b12,0x665099d5bf3b03ad,0xa3a1c0b7bfa86b57 // 'n'->'r'
},
{ 0x61a33e6417b461c1,0,0,0,0,0,0,0,0,0x662f6cc4e75a2d46,0,0, // 'B'->'K'+2
0x05a0106f37aad5ea,0,0x6e87d4e2155b2c35,0x5fefcb0bbfcf2330,0x9d51afe28d5c7c5e, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xa95f1861bb50483b,
0x11ee48ee95a03950,0,0,0,0,0,0,0,0,0xa01779930bad669a,0,0, // 'b'->'k'+2
0xd2893f70f641767c,0,0xe9fb540b358b50a3,0xa7469be14aca2e3a,0xabfab619497343b1 // 'n'->'r'
},
{ 0xb9f194613da6f46a,0,0,0,0,0,0,0,0,0x52f7155fad6120c9,0,0, // 'B'->'K'+2
0x8973c92d19acdd2c,0,0x50f3cb061023470d,0x1c483a590434bb79,0xd5542f588e3f0746, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x67b069ededf5a226,
0xc69b0a26025d8ea7,0,0,0,0,0,0,0,0,0x67c69033ab7fa688,0,0, // 'b'->'k'+2
0x47f9a410d541fc0d,0,0x522fdf97c8ffc7f8,0xb6c3eedafbfd0387,0x07aad303481f76d0 // 'n'->'r'
},
{ 0x8fc3875ab4183bf8,0,0,0,0,0,0,0,0,0xbcbcb1ae961efa16,0,0, // 'B'->'K'+2
0x66501e7a2e7f61f8,0,0x1c1ad59d105f5f4f,0x87e67302832c37d9,0x9b3702857c521708, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x15d1d57994982ee3,
0xb4060fc7fa3d1f06,0,0,0,0,0,0,0,0,0xaa69db0fc99c5cd1,0,0, // 'b'->'k'+2
0xa2815b4ee062a5c7,0,0x079625a39b41f9d4,0xf58a58b4569195d9,0xe3a8556737e93fc2 // 'n'->'r'
},
{ 0x1a71bf76f629763c,0,0,0,0,0,0,0,0,0xae9f59077485f190,0,0, // 'B'->'K'+2
0xddfeaab33b50cc38,0,0xe42d2d66e0fd9b72,0x077902f9f3068eed,0x004f23b37e054a97, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x88f04f9df0fe2118,
0xefed92b7b72f0404,0,0,0,0,0,0,0,0,0x677c8271cc988a64,0,0, // 'b'->'k'+2
0xf553a18b7c74f3ec,0,0x8630e9c3a1650931,0xcbdb96cdb5636957,0x5d772f7adfd1561e // 'n'->'r'
},
{ 0xfdf88d377f861e36,0,0,0,0,0,0,0,0,0x30c8fe584b036099,0,0, // 'B'->'K'+2
0x5af009fbd8346f14,0,0x04e53cfcd9545d61,0xd92cd1f831c06965,0x84a577449e2d2ab9, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xc54aec75c5f8b197,
0xd7c0397303637d9b,0,0,0,0,0,0,0,0,0xb8747dd6f969041d,0,0, // 'b'->'k'+2
0x5f8b14b958e44ba1,0,0xa227795ddcc05573,0x390d9a6625ec8f35,0x4eb0338bc7ca0a77 // 'n'->'r'
},
{ 0x149dbecefb592bb3,0,0,0,0,0,0,0,0,0x898b1e52fc2b1356,0,0, // 'B'->'K'+2
0x15d6efd97a7679f6,0,0x464a8cecc0e9f007,0x38ad70037f550a69,0x023980a501094bf1, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x199a8587a3b47889,
0x0662c71d44fc9ab6,0,0,0,0,0,0,0,0,0x43d9a44e5e5b8f80,0,0, // 'b'->'k'+2
0x24efef0b69160353,0,0x10ef2bc9230be578,0x8385c20b6da013a4,0x10cb7b10d2764ed1 // 'n'->'r'
},
{ 0x39001c3c4c3f5c94,0,0,0,0,0,0,0,0,0xdb34ea7b3099df75,0,0, // 'B'->'K'+2
0x5e96e06766b09bf0,0,0x2980b6bf82e5cd03,0x0e1b82bb1ee3607e,0x8f475881396cd72a, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe9443792fb0f2241,
0xc6012eb5190c5614,0,0,0,0,0,0,0,0,0xe28c351c67f78324,0,0, // 'b'->'k'+2
0x74d741c0dcb89544,0,0xe5b3f35591b7cbd0,0x27432ed8f9114070,0x550a764957f687af // 'n'->'r'
},
{ 0x3318bb88f5f9428a,0,0,0,0,0,0,0,0,0xb6825fd2c9f390ed,0,0, // 'B'->'K'+2
0x6ed80d8be8140568,0,0x6d4c29dc694fb3de,0x873a5975c627f75b,0x4d3bb7b35bf9362b, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x5974eb515549003f,
0x120671b766458f9f,0,0,0,0,0,0,0,0,0xc80f0c0f14c30f94,0,0, // 'b'->'k'+2
0x6bfe00834d44c9c6,0,0xc042f46a6840f509,0x6368e9d8c674cdbc,0xed5dc0d53b73b25b // 'n'->'r'
},
{ 0x290f8d1ced1c4a6f,0,0,0,0,0,0,0,0,0x07696f3a21eab5a3,0,0, // 'B'->'K'+2
0x59a72ed553478953,0,0xe54c064e0dad674c,0x187a8b6ff3ef5512,0x647f6341b9c08d71, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xdf00934c03921f4a,
0xe0dd050b02ece8e2,0,0,0,0,0,0,0,0,0xaae76519889134e1,0,0, // 'b'->'k'+2
0xb0d74567c544c7ab,0,0x3155f70b4df91683,0xfcc2e35a259e4b8c,0xeb0812ede2031ce4 // 'n'->'r'
},
{ 0xc26055a2145b8f3a,0,0,0,0,0,0,0,0,0x9465f7814028cf81,0,0, // 'B'->'K'+2
0x5d52cbfe16f03971,0,0x74b5c290ad6adc80,0x8045ad01ac0b5327,0xa4712a10cf77f418, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x605b0a213ed062ba,
0x4107cc216ea14124,0,0,0,0,0,0,0,0,0x5d6adcac6ba87963,0,0, // 'b'->'k'+2
0x8d1385e6c08be345,0,0x42caa3288eafb886,0x21c46948d460d003,0x7ef7e8cddc4d14e2 // 'n'->'r'
},
{ 0x3355046a61085b79,0,0,0,0,0,0,0,0,0xae868253ba1f92a8,0,0, // 'B'->'K'+2
0x839912f218b779bc,0,0x46ffc5a0453435a1,0x18f5539741925d1c,0x863dc14421a8db44, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xda13159f9789101a,
0x1e0ca2960e2d02e0,0,0,0,0,0,0,0,0,0x65425c4079fa68f8,0,0, // 'b'->'k'+2
0x28eb9ee54d35916d,0,0x3baafd1f7ce947b3,0x0bfb804f431a2cc9,0x95dee053756135b5 // 'n'->'r'
},
{ 0xf881db0f74c5a0c5,0,0,0,0,0,0,0,0,0xbf30ab33864bb3a1,0,0, // 'B'->'K'+2
0x00fcfdf9aeeb8687,0,0x9be6ad8c7127ea7d,0x2db76aadb214825e,0x943a140ada464848, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9ce4d5f44894b0f6,
0x2b8ba6696ef5db54,0,0,0,0,0,0,0,0,0x14d4a3506142e487,0,0, // 'b'->'k'+2
0xafb56c46d3adc6c3,0,0xe1c3f8152e5fe8d5,0xfa0faede82643ddb,0xb83906c3c9de1e6c // 'n'->'r'
},
{ 0x9bccc550161ccd43,0,0,0,0,0,0,0,0,0xf76555400e8d9866,0,0, // 'B'->'K'+2
0x5410a481a8f85f54,0,0x81f46732b26e6947,0xcd7d3b6034e36253,0x4ce7416bc75894df, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xd61bf3fbd8e70900,
0x8cac11d2c7042e85,0,0,0,0,0,0,0,0,0x6a4fc952ae6d8d5b,0,0, // 'b'->'k'+2
0xee4a22b94269846b,0,0x6a654d962da97b9e,0x85509f0f5fb237c9,0xefc6238f11e247d3 // 'n'->'r'
},
{ 0x4467ae1c966cee07,0,0,0,0,0,0,0,0,0xb8e10d47027aec95,0,0, // 'B'->'K'+2
0xe09d351b45d7a7e5,0,0x086c38d8e45d5ddc,0x5f3611395ef03588,0x6d0acb3a222ac6ab, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x005aa8d83272262e,
0x180977ccc7792000,0,0,0,0,0,0,0,0,0x3f68490d75b91d68,0,0, // 'b'->'k'+2
0xfa821792ecd782b3,0,0x5177c04e0b6bb626,0x93411fceb715f459,0xdbd8d714ccbf6c4a // 'n'->'r'
},
{ 0xa4c816477da649f3,0,0,0,0,0,0,0,0,0x756076b713b36ae2,0,0, // 'B'->'K'+2
0x5d4d6d2c78310a7b,0,0x71d078eb84d26157,0xaaef5cf5e1f93c60,0x560acc5b4e8b1b53, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x9264582c7d08711a,
0xe1741f0f93d9dace,0,0,0,0,0,0,0,0,0xc651a7fd6a211820,0,0, // 'b'->'k'+2
0xf1ed4657f59d6c73,0,0xe66d17cb2c9299c6,0xfdec864da5441761,0x6780a1fe79ac91ac // 'n'->'r'
},
{ 0x60721d9d090d833b,0,0,0,0,0,0,0,0,0xe535565fc89d2739,0,0, // 'B'->'K'+2
0xf755706e6e2edab2,0,0x10a93ed28e7228ad,0xcab89e84829076e9,0xaf7b721c28ed0c84, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xacf9f6c18942edb9,
0x3b27683124d2005d,0,0,0,0,0,0,0,0,0x3eb113b1ae6fbd5b,0,0, // 'b'->'k'+2
0x89f34957a6433591,0,0x3769be39471089a3,0xc5e59ed08a0a8ec2,0x2a821c2920fd0194 // 'n'->'r'
},
{ 0xbf2025da536013ad,0,0,0,0,0,0,0,0,0xec39c6f0648664b9,0,0, // 'B'->'K'+2
0xb8afa4c225a2b3cf,0,0x4b489baff4d70177,0x7b9ec91128ed3ea4,0x73fdfc142fe7cf69, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x31ab7aa621212abe,
0x7e740540e76b7e04,0,0,0,0,0,0,0,0,0x349ffe86943441f1,0,0, // 'b'->'k'+2
0xc73640ec8b36ddf2,0,0x89147296179e5ccd,0xd81fc84f74f8259e,0x7014984ae919756d // 'n'->'r'
},
{ 0x239a44a2e1cd7757,0,0,0,0,0,0,0,0,0xf998eea8153da2e2,0,0, // 'B'->'K'+2
0x6d499aa6756711a3,0,0x4d02cbf6cce59a49,0xd7c55695b9630cda,0x14375f22e08ba7b7, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xd16aa1756626861a,
0xba14aca017ecf576,0,0,0,0,0,0,0,0,0x1a37c9aae76f7416,0,0, // 'b'->'k'+2
0xf9b5657f6d2261cc,0,0x2808bd2cb0a57acf,0xc83702637924fd62,0x4ddff729b31a6e5a // 'n'->'r'
},
{ 0x3f3e5af99487cc33,0,0,0,0,0,0,0,0,0x134abb6753e57be6,0,0, // 'B'->'K'+2
0x095c0f9bb75bc72e,0,0x6cb6b6fbc1bc3ed0,0x682c093006edfe3d,0x1b8cd57fa2d4e5bc, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xe0b4468abb3cdb2f,
0x9176b5443d71f7fa,0,0,0,0,0,0,0,0,0x6e972511c457b868,0,0, // 'b'->'k'+2
0x3f1e5b0329191280,0,0x48b9de6502800d8a,0x98afd65ecbe04fcb,0xef6ff1d74eebd78d // 'n'->'r'
},
{ 0x1e16291df58bf147,0,0,0,0,0,0,0,0,0xc5b332663b9d125e,0,0, // 'B'->'K'+2
0xf9d3867b75489606,0,0x9c699c9e80e09ead,0xeebc54cb974abcf5,0x00af71c2f427159e, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x644ccddddb93b60f,
0xee771d3c8eccb8a9,0,0,0,0,0,0,0,0,0x3dff6a87750c98a6,0,0, // 'b'->'k'+2
0xac809ab318f3b535,0,0x401a18f4f3ae0bab,0x3976aa499f265252,0x7bbfadd793646d87 // 'n'->'r'
},
{ 0x065637c0dcef0cdc,0,0,0,0,0,0,0,0,0x0a3cf7f0d21dcb41,0,0, // 'B'->'K'+2
0x01e97191285a96a9,0,0xa3c3b6a8e8a9fb42,0xed6a40f3fe0fdc72,0x68868a15d0c62b5c, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xb172765e15c2a14e,
0x609db79a28cf62e5,0,0,0,0,0,0,0,0,0xb4848c8f182e64db,0,0, // 'b'->'k'+2
0xcf328af0a0ff7cf6,0,0x9897b711a2342064,0xb583590a65ffc99f,0x89884691f30528dd // 'n'->'r'
},
{ 0xf44f3883100df4b2,0,0,0,0,0,0,0,0,0x74a0cbe7efce9dfc,0,0, // 'B'->'K'+2
0x5a187e496c8d60ae,0,0x99a6431d7287625d,0xe5c55cc342391e72,0xa771e9c7ba4a4ea1, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xc51c91d0d95a930c,
0x5f7f88e2be034ee0,0,0,0,0,0,0,0,0,0x5b802e840886a6e9,0,0, // 'b'->'k'+2
0xab1161bd4e96a350,0,0x9f25775af57fe442,0x74f664641ea955c8,0x49dfb8865af973f3 // 'n'->'r'
},
{ 0x15c6f02071a2087d,0,0,0,0,0,0,0,0,0xdfd8ac515b51248a,0,0, // 'B'->'K'+2
0x3bb14677644b5270,0,0x1cc80976042e1ada,0x14d4c6f58827449b,0x366219252f6b62b8, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x526fba77d8695c78,
0x2edb451b66b8f141,0,0,0,0,0,0,0,0,0x9c7ff433894949c0,0,0, // 'b'->'k'+2
0x672cb64eede60ac5,0,0x5e1cbfbbae262f58,0xbec7965619805d22,0xb9ea065f9bf30fcf // 'n'->'r'
},
{ 0x86e36808f1ff4803,0,0,0,0,0,0,0,0,0xad954d381935dabc,0,0, // 'B'->'K'+2
0x7cd85b1dde96ccee,0,0x250a7a9c178f1ea5,0x0023c7df7443fcab,0x2b04d5a20e53c6d3, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x6ce720ba53a2ab58,
0x107ed77f1626fe46,0,0,0,0,0,0,0,0,0x10450f7e3b951e94,0,0, // 'b'->'k'+2
0x43ab4fd13cb76386,0,0x355015dc9d4d8f1c,0x592de86fd6ea5273,0xeeb15e9008779386 // 'n'->'r'
},
{ 0x16976fc885ba1342,0,0,0,0,0,0,0,0,0x3724563b03fec25c,0,0, // 'B'->'K'+2
0x9a2bb0f78358dfdc,0,0xdbbc03ec6dc58e66,0xb6e15407a65b6365,0xcd8a6b8c116d4d7b, // 'N'->'R'
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0x283fb5208b6a4ec5,
0x28bdced4407f346d,0,0,0,0,0,0,0,0,0x579652eb084fa549,0,0, // 'b'->'k'+2
0x9b0ff04b389e0064,0,0xba2d0cdd9484d2b6,0x1d9c042840d1234d,0xa9cf3400c5661795 // 'n'->'r'
}
};
/****************************************************************************
* ChessPosition.cpp Chess classes - Representation of the position on the board
* Author: Bill Forster
* License: MIT license. Full text of license is in associated file LICENSE
* Copyright 2010-2014, Bill Forster <billforsternz at gmail dot com>
****************************************************************************/
/* Some project notes */
/*====================*/
/****************************************************************************
* Class Hierarchy:
*
* The Chess classes are intended to provide a reusable chess subsystem. To
* understand the hierarchy of classes, think in terms of the Java concept
* of derived classes "extending" base classes.
*
* So
* ChessPositionRaw
* ;A simple C style structure that holds a chess position
* ChessPosition extends ChessPositionRaw
* ;ChessPosition adds constructors, and other simple facilities
* ChessRules extends ChessPosition
* ;ChessRules adds all the rules of standard chess
* ChessEvaluation extends ChessRules
* ;ChessEvaluation is a simple scoring function for a chess engine
* ;it attempts to calculate a score (more +ve numbers for better white
* ;positions, more -ve numbers for better black positions) for a
* ;position. Tarrasch GUI uses this only to attempt to list the most
* ;plausible moves first when you click on a square that can receive
* ;multiple moves
* ChessEngine extends ChessEvaluation
* ;ChessEngine adds a search tree to ChessEvaluation to make a
* ;complete simple engine (the Tarrasch Toy Engine)
****************************************************************************/
/****************************************************************************
* Explanation of namespace thc:
*
* The Chess classes use the C++ namespace facility to ensure they can be
* used without name conflicts with other 3rd party code. A short, but
* highly likely to be unique namespace name is best, we choose "thc" which
* is short for TripleHappyChess.
****************************************************************************/
/****************************************************************************
* My original license, now replaced by MIT license full text of which is
* in file LICENSE in project's root directory.
*
* Licensing provisions for all TripleHappy Chess source code;
*
* Start Date: 15 February 2003.
* This software is licensed to be used freely. The following licensing
* provisions apply;
*
* 1) The 'author' is asserted to be the original author of the code, Bill
* Forster of Wellington, New Zealand.
* 2) The 'licensee' is anyone else who wishes to use the software.
* 3) The 'licensee' is entitled to do anything they wish with the software
* EXCEPT for any action that attempts to restrict in any way the rights
* granted in 4) below.
* 4) The 'author' is entitled to do anything he wishes with the software.
*
* The intent of this license is to allow the licensees wide freedom to
* incorporate, modify and sell the software, with the single caveat that
* they cannot prevent the author from either further development or future
* commercial use of the software.
****************************************************************************/
// Return true if ChessPositions are the same (including counts)
bool ChessPosition::CmpStrict( const ChessPosition &other ) const
{
return( *this == other &&
half_move_clock == other.half_move_clock &&
full_move_count == other.full_move_count
);
}
std::string ChessPosition::ToDebugStr( const char *label )
{
std::string s;
const char *p = squares;
if( label )
s = label;
s += (white ? "\nWhite to move\n" : "\nBlack to move\n");
for( int row=0; row<8; row++ )
{
for( int col=0; col<8; col++ )
{
char c = *p++;
if( c==' ' )
c = '.';
s += c;
}
s += '\n';
}
return s;
}
/****************************************************************************
* Set up position on board from Forsyth string with extensions
* return bool okay
****************************************************************************/
bool ChessPosition::Forsyth( const char *txt )
{
int file, rank, skip, store, temp;
int count_wking=0, count_bking=0;
char c, cross;
char p;
bool okay, done;
const char *reset = txt;
// When store==0 validate txt without storing results
for( store=0, okay=true; store<2 && okay; store++ )
{
txt = reset;
// Clear the board
if( store )
{
for( Square square=a8; square<=h1; ++square )
{
squares[square] = ' ';
}
// Clear the extension fields
wking = false;
wqueen = false;
bking = false;
bqueen = false;
enpassant_target = SQUARE_INVALID;
half_move_clock = 0;
full_move_count = 1;
}
// Loop through the main Forsyth field
for( file=0, rank=7, done=false; *txt && okay && !done; )
{
skip = 1;
c = *txt++;
p = ' ';
cross = ' ';
switch(c)
{
case 'x': cross = 'x';
skip = 1;
break;
case ' ':
case '\t': done = true; break;
case 'k': p = 'k';