forked from tech-squares/sd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsdgetout.cpp
More file actions
2095 lines (1766 loc) · 89.6 KB
/
Copy pathsdgetout.cpp
File metadata and controls
2095 lines (1766 loc) · 89.6 KB
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
// -*- mode:c++; indent-tabs-mode:nil; c-basic-offset:3; fill-column:88 -*-
// SD -- square dance caller's helper.
//
// Copyright (C) 1990-2013 William B. Ackerman.
//
// This file is part of "Sd".
//
// ===================================================================
//
// If you received this file with express permission from the licensor
// to modify and redistribute it it under the terms of the Creative
// Commons CC BY-NC-SA 3.0 license, then that license applies. See
// http://creativecommons.org/licenses/by-nc-sa/3.0/
//
// ===================================================================
//
// Otherwise, the GNU General Public License applies.
//
// Sd is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// Sd is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License,
// in the file COPYING.txt, along with Sd. See
// http://www.gnu.org/licenses/
//
// ===================================================================
//
// This is for version 38.
/* This defines the following functions:
configuration::null_resolve_thing
configuration::null_resolve_ptr
configuration::calculate_resolve
write_resolve_text
full_resolve
configuration::concepts_in_place
resolve_command_ok
nice_setup_command_ok
create_resolve_menu_title
initialize_getout_tables
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "sdui.h"
#include "sd.h"
struct resolve_rec {
configuration stuph[MAX_RESOLVE_SIZE];
int size;
int insertion_point;
int insertion_width;
personrec permutepersoninfo[8];
int rotchange;
};
struct reconcile_descriptor {
int perm[8];
bool allow_eighth_rotation;
};
static const reconcile_descriptor promperm = {{1, 0, 6, 7, 5, 4, 2, 3}, false};
static const reconcile_descriptor rpromperm = {{0, 1, 7, 6, 4, 5, 3, 2}, false};
static const reconcile_descriptor rlgperm = {{1, 0, 6, 7, 5, 4, 2, 3}, false};
static const reconcile_descriptor qtagperm = {{1, 0, 7, 6, 5, 4, 3, 2}, false};
static const reconcile_descriptor homeperm = {{6, 5, 4, 3, 2, 1, 0, 7}, true};
static const reconcile_descriptor sglperm = {{7, 6, 5, 4, 3, 2, 1, 0}, true};
static const reconcile_descriptor crossperm = {{5, 4, 3, 2, 1, 0, 7, 6}, false};
static const reconcile_descriptor crossplus = {{5, 4, 3, 2, 1, 0, 7, 6}, false};
static const reconcile_descriptor laperm = {{1, 7, 6, 4, 5, 3, 2, 0}, false};
static configuration *huge_history_save = (configuration *) 0;
static int huge_history_allocation = 0;
static int huge_history_ptr;
static resolve_rec *all_resolves = (resolve_rec *) 0;
static int resolve_allocation = 0;
static int *avoid_list = (int *) 0;
static int avoid_list_size;
static int avoid_list_allocation = 0;
static uint32 perm_array[8];
static setup_kind goal_kind;
static int goal_rotation;
static uint32 goal_directions[8];
static const reconcile_descriptor *current_reconciler;
// BEWARE!! This must be keyed to the enumeration "command_kind" in sd.h .
static Cstring title_string[] = {
"Resolve: ",
"Normalize: ",
"Standardize: ",
"Reconcile: ",
"Pick Random Call: ",
"Pick Simple Call: ",
"Pick Concept Call: ",
"Pick Level Call: ",
"Pick 8 Person Level Call: ",
"Create Setup: ",
};
static const char *resolve_distances[] = {
"0",
"1/8",
"1/4",
"3/8",
"1/2",
"5/8",
"3/4",
"7/8",
"0"};
// BEWARE!! This enum must track the table "resolve_first_parts".
enum first_part_kind {
first_part_none,
first_part_ext,
first_part_slcl,
first_part_circ,
first_part_pthru,
first_part_trby,
first_part_xby,
first_part_dixie
};
// Beware!! This table must track the definition of enum "first_part_kind".
static Cstring resolve_first_parts[] = {
(Cstring) 0,
"extend",
"slip the clutch",
"circulate",
"pass thru",
"trade by",
"cross by",
"dixie grand",};
// BEWARE!! This enum must track the table "resolve_main_parts".
enum main_part_kind {
main_part_none,
main_part_rlg,
main_part_la,
main_part_dixgnd,
main_part_minigrand,
main_part_prom,
main_part_revprom,
main_part_sglprom,
main_part_rsglprom,
main_part_circ,
main_part_swing
};
// Beware!! This table must track the definition of enum "main_part_kind".
static Cstring resolve_main_parts[] = {
"???",
"right and left grand",
"left allemande",
"dixie grand, left allemande",
"mini-grand",
"promenade",
"reverse promenade",
"single file promenade",
"reverse single file promenade",
"circle right",
"swing and promenade"};
struct resolve_descriptor {
// 0 means accept all such resolves.
// Each increase cuts the acceptance probability in half when searching
// randomly. For example, 4 means accept only 1/16 of such resolves,
// throwing away the other 15/16.
// Also, 4 or more means it will not be accepted in the "initial scan" parts of a resolve.
short int how_bad;
short int not_in_reconcile; // Nonzero => do not accept in a reconcile.
first_part_kind first_part;
main_part_kind main_part;
};
// BEWARE!! This list must track the array "resolve_table".
enum resolve_kind {
resolve_none,
resolve_rlg,
resolve_la,
resolve_ext_rlg,
resolve_ext_la,
resolve_bad_ext_la,
resolve_slipclutch_rlg,
resolve_slipclutch_la,
resolve_circ_rlg,
resolve_circ_la,
resolve_pth_rlg,
resolve_pth_la,
resolve_tby_rlg,
resolve_tby_la,
resolve_xby_rlg,
resolve_xby_la,
resolve_dixie_grand,
resolve_bad_dixie_grand,
resolve_singing_dixie_grand,
resolve_minigrand,
resolve_prom,
resolve_revprom,
resolve_sglfileprom,
resolve_revsglfileprom,
resolve_circle,
resolve_circle_from_facing_lines
};
// BEWARE!! This list is keyed to the definition of "resolve_kind".
static const resolve_descriptor resolve_table[] = {
{2, 1, first_part_none, main_part_none}, // resolve_none
{0, 0, first_part_none, main_part_rlg}, // resolve_rlg
{0, 0, first_part_none, main_part_la}, // resolve_la
{1, 1, first_part_ext, main_part_rlg}, // resolve_ext_rlg
{1, 1, first_part_ext, main_part_la}, // resolve_ext_la
{3, 1, first_part_ext, main_part_la}, // resolve_bad_ext_la
{2, 1, first_part_slcl, main_part_rlg}, // resolve_slipclutch_rlg
{2, 1, first_part_slcl, main_part_la}, // resolve_slipclutch_la
{3, 1, first_part_circ, main_part_rlg}, // resolve_circ_rlg
{3, 1, first_part_circ, main_part_la}, // resolve_circ_la
{3, 1, first_part_pthru, main_part_rlg}, // resolve_pth_rlg
{3, 1, first_part_pthru, main_part_la}, // resolve_pth_la
{4, 1, first_part_trby, main_part_rlg}, // resolve_tby_rlg
{4, 1, first_part_trby, main_part_la}, // resolve_tby_la
{1, 1, first_part_xby, main_part_rlg}, // resolve_xby_rlg
{1, 1, first_part_xby, main_part_la}, // resolve_xby_la
{1, 0, first_part_none, main_part_dixgnd}, // resolve_dixie_grand
{4, 1, first_part_none, main_part_dixgnd}, // resolve_bad_dixie_grand
{0, 0, first_part_none, main_part_dixgnd}, // resolve_singing_dixie_grand
{2, 1, first_part_none, main_part_minigrand},// resolve_minigrand
{0, 0, first_part_none, main_part_prom}, // resolve_prom
{1, 0, first_part_none, main_part_revprom}, // resolve_revprom
{3, 0, first_part_none, main_part_sglprom}, // resolve_sglfileprom
{4, 0, first_part_none, main_part_rsglprom}, // resolve_revsglfileprom
{2, 0, first_part_none, main_part_circ}, // resolve_circle
{2, 0, first_part_none, main_part_circ}}; // resolve_circle_from_facing_lines
// Some resolves are only legal at certain levels, so there is a "level" field
// in a resolve_tester. We define these short names to keep the table entries
// from being unwieldy.
enum level_abbreviation {
MS = l_mainstream,
XB = cross_by_level,
DX = dixie_grand_level,
EX = extend_34_level
};
struct resolve_tester {
resolve_kind k;
level_abbreviation level_needed;
// Notes for "distance" field:
// Add 0x10 bit for singer-only; these must be last.
// Also, last item in each table has 0x10 only.
// Add 0x20 bit -- same as 0x40 if distance is zero, otherwise OK.
// Add 0x40 bit to make the resolver never find this, though
// we will display it if user gets here.
uint32 distance;
veryshort locations[8];
uint32 directions;
};
bool configuration::sequence_is_resolved()
{
return current_resolve().the_item->k != resolve_none;
}
const resolve_tester null_resolve_thing = {
resolve_none, MS, 0, {0,0,0,0,0,0,0,0}, 0};
const resolve_tester *configuration::null_resolve_ptr = &null_resolve_thing;
static const resolve_tester test_thar_stuff[] = {
{resolve_rlg, MS, 2, {5, 4, 3, 2, 1, 0, 7, 6}, 0x8A31A813},
{resolve_minigrand, MS, 4, {5, 0, 3, 6, 1, 4, 7, 2}, 0x8833AA11},
{resolve_prom, MS, 6, {5, 4, 3, 2, 1, 0, 7, 6}, 0x8833AA11},
{resolve_slipclutch_rlg, MS, 1, {5, 2, 3, 0, 1, 6, 7, 4}, 0x8138A31A},
{resolve_la, MS, 5, {5, 2, 3, 0, 1, 6, 7, 4}, 0xA31A8138},
{resolve_slipclutch_la, MS, 6, {5, 4, 3, 2, 1, 0, 7, 6}, 0xA8138A31},
{resolve_xby_rlg, XB, 1, {4, 3, 2, 1, 0, 7, 6, 5}, 0x8138A31A},
{resolve_revprom, MS, 4, {2, 3, 0, 1, 6, 7, 4, 5}, 0x118833AA},
{resolve_xby_la, XB, 4, {2, 3, 0, 1, 6, 7, 4, 5}, 0x138A31A8},
{resolve_bad_dixie_grand,DX, 0, {4, 1, 2, 7, 0, 5, 6, 3}, 0xAA118833},
{resolve_none, MS, 0x10}};
static const resolve_tester test_rigger_stuff[] = {
{resolve_rlg, MS, 2, {3, 2, 1, 0, 7, 6, 5, 4}, 0x8A31A813},
{resolve_minigrand, MS, 4, {3, 6, 1, 4, 7, 2, 5, 0}, 0x8833AA11},
{resolve_la, MS, 5, {3, 1, 0, 6, 7, 5, 4, 2}, 0xA31A8138},
{resolve_bad_dixie_grand,DX, 0, {2, 7, 0, 5, 6, 3, 4, 1}, 0xAA118833},
// From a strange rigger. This rates about
// 500 milli-Tersoffs, on a scale named after Mike Tersoff, a devotee
// of extremely strange getout positions.
{resolve_rlg, MS, 2, {3, 2, 1, 0, 7, 6, 5, 4}, 0x8AA8A88A},
{resolve_minigrand, MS, 4, {3, 6, 1, 4, 7, 2, 5, 0}, 0x88AAAA88},
{resolve_la, MS, 5, {3, 1, 0, 6, 7, 5, 4, 2}, 0xA8AA8A88},
{resolve_none, MS, 0x10}};
static const resolve_tester test_4x4_stuff[] = {
// "Circle left/right", etc. from squared-set.
{resolve_circle, MS, 6, {2, 1, 14, 13, 10, 9, 6, 5}, 0x33AA1188},
{resolve_circle, MS, 7, {5, 2, 1, 14, 13, 10, 9, 6}, 0x833AA118},
{resolve_sglfileprom, MS, 6, {2, 1, 14, 13, 10, 9, 6, 5}, 0x8833AA11},
{resolve_sglfileprom, MS, 7, {5, 2, 1, 14, 13, 10, 9, 6}, 0x18833AA1},
{resolve_revsglfileprom, MS, 6, {2, 1, 14, 13, 10, 9, 6, 5}, 0xAA118833},
{resolve_revsglfileprom, MS, 7, {5, 2, 1, 14, 13, 10, 9, 6}, 0x3AA11883},
// From vertical 8-chain in "O".
{resolve_rlg, MS, 3, {5, 2, 1, 14, 13, 10, 9, 6}, 0x8A8AA8A8},
{resolve_la, MS, 6, {2, 1, 14, 13, 10, 9, 6, 5}, 0xA8AA8A88},
// From horizontal 8-chain in "O".
{resolve_rlg, MS, 3, {5, 2, 1, 14, 13, 10, 9, 6}, 0x13313113},
{resolve_la, MS, 6, {2, 1, 14, 13, 10, 9, 6, 5}, 0x33131131},
// Weird ones from squared set.
{resolve_rlg, MS, 3, {5, 2, 1, 14, 13, 10, 9, 6}, 0x8A31A813},
{resolve_rlg, MS, 3, {5, 2, 1, 14, 13, 10, 9, 6}, 0x138A31A8},
{resolve_la, MS, 6, {2, 1, 14, 13, 10, 9, 6, 5}, 0x38A31A81},
{resolve_la, MS, 6, {2, 1, 14, 13, 10, 9, 6, 5}, 0xA31A8138},
// From squared set, around the corner.
{resolve_rlg, MS, 3, {5, 2, 1, 14, 13, 10, 9, 6}, 0x1A8138A3},
{resolve_la, MS, 6, {2, 1, 14, 13, 10, 9, 6, 5}, 0xA8138A31},
// From squared set, facing directly.
{resolve_rlg, MS, 2, {2, 1, 14, 13, 10, 9, 6, 5}, 0x8A31A813},
{resolve_la, MS, 7, {5, 2, 1, 14, 13, 10, 9, 6}, 0x38A31A81},
// From ladder columns, facing directly.
{resolve_rlg, MS, 3, {7, 2, 0, 14, 15, 10, 8, 6}, 0x13313113},
{resolve_rlg, MS, 1, {3, 14, 12, 10, 11, 6, 4, 2}, 0x8AA8A88A},
{resolve_rlg, MS, 3, {5, 4, 1, 3, 13, 12, 9, 11}, 0x13313113},
{resolve_rlg, MS, 1, {1, 0, 13, 15, 9, 8, 5, 7}, 0x8AA8A88A},
{resolve_la, MS, 6, {2, 0, 14, 15, 10, 8, 6, 7}, 0x33131131},
{resolve_la, MS, 4, {14, 12, 10, 11, 6, 4, 2, 3}, 0xAA8A88A8},
{resolve_la, MS, 6, {4, 1, 3, 13, 12, 9, 11, 5}, 0x33131131},
{resolve_la, MS, 4, {0, 13, 15, 9, 8, 5, 7, 1}, 0xAA8A88A8},
// From pinwheel, facing directly.
{resolve_rlg, MS, 3, {7, 2, 3, 14, 15, 10, 11, 6}, 0x138A31A8},
{resolve_rlg, MS, 3, {5, 7, 1, 3, 13, 15, 9, 11}, 0x8A31A813},
// From pinwheel, all in miniwaves.
{resolve_rlg, MS, 3, {7, 5, 3, 1, 15, 13, 11, 9}, 0x138A31A8},
{resolve_rlg, MS, 3, {7, 2, 3, 14, 15, 10, 11, 6}, 0x8A31A813},
// From pinwheel, some of each.
{resolve_rlg, MS, 3, {7, 2, 3, 14, 15, 10, 11, 6}, 0x13313113},
{resolve_rlg, MS, 3, {5, 7, 3, 1, 13, 15, 11, 9}, 0x8A8AA8A8},
// From pinwheel, others of each.
{resolve_rlg, MS, 3, {7, 2, 3, 14, 15, 10, 11, 6}, 0x8A8AA8A8},
{resolve_rlg, MS, 3, {7, 5, 1, 3, 15, 13, 9, 11}, 0x13313113},
// From clumps.
{resolve_rlg, MS, 2, {3, 1, 14, 0, 11, 9, 6, 8}, 0x8A8AA8A8},
{resolve_rlg, MS, 4, {5, 4, 7, 2, 13, 12, 15, 10}, 0x8A8AA8A8},
{resolve_rlg, MS, 2, {1, 0, 3, 14, 9, 8, 11, 6}, 0x31311313},
{resolve_rlg, MS, 4, {7, 5, 2, 4, 15, 13, 10, 12}, 0x13133131},
{resolve_la, MS, 5, {3, 0, 14, 9, 11, 8, 6, 1}, 0xA8AA8A88},
{resolve_la, MS, 7, {5, 2, 7, 12, 13, 10, 15, 4}, 0xA8AA8A88},
{resolve_la, MS, 5, {1, 14, 3, 8, 9, 6, 11, 0}, 0x13113133},
{resolve_la, MS, 7, {7, 4, 2, 13, 15, 12, 10, 5}, 0x31331311},
// From stairstep lines.
{resolve_rlg, MS, 3, {7, 2, 14, 0, 15, 10, 6, 8}, 0x8A8AA8A8},
{resolve_rlg, MS, 3, {5, 4, 3, 1, 13, 12, 11, 9}, 0x8A8AA8A8},
{resolve_rlg, MS, 1, {1, 0, 15, 13, 9, 8, 7, 5}, 0x31311313},
{resolve_rlg, MS, 5, {11, 6, 2, 4, 3, 14, 10, 12}, 0x13133131},
{resolve_la, MS, 6, {7, 0, 14, 10, 15, 8, 6, 2}, 0xA8AA8A88},
{resolve_la, MS, 6, {5, 1, 3, 12, 13, 9, 11, 4}, 0xA8AA8A88},
{resolve_la, MS, 4, {1, 13, 15, 8, 9, 5, 7, 0}, 0x13113133},
{resolve_la, MS, 0, {11, 4, 2, 14, 3, 12, 10, 6}, 0x31331311},
{resolve_prom, MS, 7, {7, 2, 14, 0, 15, 10, 6, 8}, 0x8888AAAA},
{resolve_prom, MS, 7, {5, 4, 3, 1, 13, 12, 11, 9}, 0x8888AAAA},
{resolve_prom, MS, 5, {1, 0, 15, 13, 9, 8, 7, 5}, 0x33331111},
{resolve_prom, MS, 1, {11, 6, 2, 4, 3, 14, 10, 12}, 0x11113333},
{resolve_revprom, MS, 7, {2, 7, 0, 14, 10, 15, 8, 6}, 0xAAAA8888},
{resolve_revprom, MS, 7, {4, 5, 1, 3, 12, 13, 9, 11}, 0xAAAA8888},
{resolve_revprom, MS, 5, {0, 1, 13, 15, 8, 9, 5, 7}, 0x11113333},
{resolve_revprom, MS, 1, {6, 11, 4, 2, 14, 3, 12, 10}, 0x33331111},
// From blocks.
{resolve_rlg, MS, 3, {5, 2, 3, 0, 13, 10, 11, 8}, 0x8A8AA8A8},
{resolve_rlg, MS, 1, {1, 14, 15, 12, 9, 6, 7, 4}, 0x31311313},
{resolve_la, MS, 7, {5, 2, 3, 0, 13, 10, 11, 8}, 0xA8A88A8A},
{resolve_la, MS, 5, {1, 14, 15, 12, 9, 6, 7, 4}, 0x13133131},
{resolve_none, MS, 0x10}};
static const resolve_tester test_alamo_stuff[] = {
// "Circle left/right", etc.
{resolve_circle, MS, 6, {3, 2, 1, 0, 7, 6, 5, 4}, 0x33AA1188},
{resolve_circle, MS, 7, {4, 3, 2, 1, 0, 7, 6, 5}, 0x833AA118},
{resolve_sglfileprom, MS, 6, {3, 2, 1, 0, 7, 6, 5, 4}, 0x8833AA11},
{resolve_sglfileprom, MS, 7, {4, 3, 2, 1, 0, 7, 6, 5}, 0x18833AA1},
{resolve_revsglfileprom, MS, 6, {3, 2, 1, 0, 7, 6, 5, 4}, 0xAA118833},
{resolve_revsglfileprom, MS, 7, {4, 3, 2, 1, 0, 7, 6, 5}, 0x3AA11883},
// Around the corner.
{resolve_rlg, MS, 3, {4, 3, 2, 1, 0, 7, 6, 5}, 0x1A8138A3},
{resolve_la, MS, 6, {3, 2, 1, 0, 7, 6, 5, 4}, 0xA8138A31},
// Facing directly.
{resolve_rlg, MS, 2, {3, 2, 1, 0, 7, 6, 5, 4}, 0x8A31A813},
{resolve_pth_rlg, MS, 1, {3, 0, 1, 6, 7, 4, 5, 2}, 0x8138A31A},
{resolve_la, MS, 7, {4, 3, 2, 1, 0, 7, 6, 5}, 0x38A31A81},
{resolve_pth_la, MS, 6, {2, 3, 0, 1, 6, 7, 4, 5}, 0xA8138A31},
{resolve_none, MS, 0x10}};
static const resolve_tester test_4x6_stuff[] = {
{resolve_rlg, MS, 2, {23, 6, 3, 2, 11, 18, 15, 14},0x8A31A813},
{resolve_la, MS, 7, {14, 23, 6, 3, 2, 11, 18, 15},0x38A31A81},
{resolve_none, MS, 0x10}};
static const resolve_tester test_c1phan_stuff[] = {
// Various circle/RLG/LA from phantom-type squared-set.
{resolve_circle, MS, 6, {11, 6, 7, 2, 3, 14, 15, 10}, 0x33AA1188},
{resolve_circle, MS, 7, {10, 11, 6, 7, 2, 3, 14, 15}, 0x833AA118},
{resolve_la, MS, 6, {11, 6, 7, 2, 3, 14, 15, 10}, 0xA8138A31},
{resolve_la, MS, 7, {10, 11, 6, 7, 2, 3, 14, 15}, 0x38A31A81},
{resolve_rlg, MS, 2, {11, 6, 7, 2, 3, 14, 15, 10}, 0x8A31A813},
{resolve_rlg, MS, 3, {10, 11, 6, 7, 2, 3, 14, 15}, 0x1A8138A3},
{resolve_sglfileprom, MS, 6, {11, 6, 7, 2, 3, 14, 15, 10}, 0x8833AA11},
{resolve_sglfileprom, MS, 7, {10, 11, 6, 7, 2, 3, 14, 15}, 0x18833AA1},
{resolve_revsglfileprom, MS, 6, {11, 6, 7, 2, 3, 14, 15, 10}, 0xAA118833},
{resolve_revsglfileprom, MS, 7, {10, 11, 6, 7, 2, 3, 14, 15}, 0x3AA11883},
// From phantoms, all facing.
{resolve_rlg, MS, 3, {10, 8, 6, 4, 2, 0, 14, 12}, 0x138A31A8},
{resolve_rlg, MS, 3, {9, 11, 5, 7, 1, 3, 13, 15}, 0x8A31A813},
// From phantoms, all in miniwaves.
{resolve_rlg, MS, 3, {11, 9, 7, 5, 3, 1, 15, 13}, 0x138A31A8},
{resolve_rlg, MS, 3, {10, 8, 6, 4, 2, 0, 14, 12}, 0x8A31A813},
// From phantoms, some of each.
{resolve_rlg, MS, 3, {10, 8, 6, 4, 2, 0, 14, 12}, 0x13313113},
{resolve_rlg, MS, 3, {9, 11, 7, 5, 1, 3, 15, 13}, 0x8A8AA8A8},
// From phantoms, others of each.
{resolve_rlg, MS, 3, {10, 8, 6, 4, 2, 0, 14, 12}, 0x8A8AA8A8},
{resolve_rlg, MS, 3, {11, 9, 5, 7, 3, 1, 13, 15}, 0x13313113},
// From phantoms, all promenade.
{resolve_prom, MS, 7, {11, 9, 7, 5, 3, 1, 15, 13}, 0x118833AA},
{resolve_prom, MS, 7, {10, 8, 6, 4, 2, 0, 14, 12}, 0x8833AA11},
{resolve_revprom, MS, 7, {9, 11, 5, 7, 1, 3, 13, 15}, 0x33AA1188},
{resolve_revprom, MS, 7, {8, 10, 4, 6, 0, 2, 12, 14}, 0xAA118833},
{resolve_none, MS, 0x10}};
static const resolve_tester test_galaxy_stuff[] = {
{resolve_rlg, MS, 2, {5, 4, 3, 2, 1, 0, 7, 6}, 0x1A313813},
{resolve_rlg, MS, 2, {5, 4, 3, 2, 1, 0, 7, 6}, 0x8A81A8A3},
{resolve_none, MS, 0x10}};
static const resolve_tester test_qtag_stuff[] = {
// From 1/4 tag.
{resolve_dixie_grand, DX, 2, {5, 0, 2, 7, 1, 4, 6, 3}, 0x8AAAA888},
{resolve_dixie_grand, DX, 2, {4, 1, 2, 7, 0, 5, 6, 3}, 0x33AA1188},
{resolve_ext_rlg, MS, 5, {7, 5, 4, 2, 3, 1, 0, 6}, 0xA88A8AA8},
{resolve_ext_la, MS, 6, {3, 2, 1, 0, 7, 6, 5, 4}, 0xA8AA8A88},
// From 3/4 tag.
{resolve_rlg, MS, 4, {5, 4, 3, 2, 1, 0, 7, 6}, 0xAA8A88A8},
{resolve_minigrand, MS, 6, {5, 0, 3, 6, 1, 4, 7, 2}, 0xA8888AAA},
{resolve_la, MS, 7, {4, 2, 3, 1, 0, 6, 7, 5}, 0xA8A88A8A},
// From diamonds with points facing each other.
{resolve_rlg, MS, 4, {5, 4, 3, 2, 1, 0, 7, 6}, 0x138A31A8},
{resolve_minigrand, MS, 6, {5, 0, 3, 6, 1, 4, 7, 2}, 0x118833AA},
{resolve_la, MS, 7, {4, 2, 3, 1, 0, 6, 7, 5}, 0x38A31A81},
// From a strange "6x2 acey deucey" situation. This rates about
// 500 milli-Tersoffs, on a scale named after Mike Tersoff, a devotee
// of extremely strange getout positions.
{resolve_rlg, MS, 4, {5, 4, 3, 2, 1, 0, 7, 6}, 0x8A8AA8A8},
{resolve_minigrand, MS, 6, {5, 0, 3, 6, 1, 4, 7, 2}, 0x8888AAAA},
{resolve_la, MS, 7, {4, 2, 3, 1, 0, 6, 7, 5}, 0x88A8AA8A},
// Singers only.
// Swing/prom from 3/4 tag, ends sashayed (normal case is above).
{resolve_rlg, MS, 0x14,{4, 5, 3, 2, 0, 1, 7, 6}, 0xAA8A88A8},
// Swing/prom from 3/4 tag, centers traded, ends normal.
{resolve_rlg, MS, 0x14,{5, 4, 2, 3, 1, 0, 6, 7}, 0xAAA8888A},
// Swing/prom from 3/4 tag, centers traded, ends sashayed.
{resolve_rlg, MS, 0x14,{4, 5, 2, 3, 0, 1, 6, 7}, 0xAAA8888A},
{resolve_none, MS, 0x10}};
static const resolve_tester test_2x6_stuff[] = {
// From "Z" 8-chain.
{resolve_rlg, MS, 3, {7, 6, 4, 3, 1, 0, 10, 9}, 0x13313113},
{resolve_rlg, MS, 3, {8, 7, 5, 4, 2, 1, 11, 10}, 0x13313113},
{resolve_la, MS, 6, {6, 4, 3, 1, 0, 10, 9, 7}, 0x33131131},
{resolve_la, MS, 6, {7, 5, 4, 2, 1, 11, 10, 8}, 0x33131131},
// From outer triple boxes.
{resolve_rlg, MS, 3, {7, 6, 4, 5, 1, 0, 10, 11}, 0x8A8AA8A8},
{resolve_la, MS, 6, {7, 5, 4, 0, 1, 11, 10, 6}, 0xA8AA8A88},
{resolve_prom, MS, 7, {7, 6, 4, 5, 1, 0, 10, 11}, 0x8888AAAA},
// From parallelogram waves.
{resolve_rlg, MS, 3, {7, 6, 2, 3, 1, 0, 8, 9}, 0x8A8AA8A8},
{resolve_la, MS, 6, {7, 3, 2, 0, 1, 9, 8, 6}, 0xA8AA8A88},
{resolve_rlg, MS, 3, {9, 8, 4, 5, 3, 2, 10, 11}, 0x8A8AA8A8},
{resolve_la, MS, 6, {9, 5, 4, 2, 3, 11, 10, 8}, 0xA8AA8A88},
{resolve_none, MS, 0x10}};
static const resolve_tester test_2x8_stuff[] = {
// From outer quadruple boxes.
{resolve_rlg, MS, 3, {9, 8, 6, 7, 1, 0, 14, 15}, 0x8A8AA8A8},
{resolve_la, MS, 6, {9, 7, 6, 0, 1, 15, 14, 8}, 0xA8AA8A88},
{resolve_none, MS, 0x10}};
static const resolve_tester test_3x4_stuff[] = {
// From offset lines.
{resolve_rlg, MS, 3, {7, 6, 5, 4, 1, 0, 11, 10}, 0x8A8AA8A8},
{resolve_rlg, MS, 3, {5, 4, 2, 3, 11, 10, 8, 9}, 0x8A8AA8A8},
{resolve_la, MS, 6, {7, 4, 5, 0, 1, 10, 11, 6}, 0xA8AA8A88},
{resolve_la, MS, 6, {5, 3, 2, 10, 11, 9, 8, 4}, 0xA8AA8A88},
{resolve_prom, MS, 7, {7, 6, 5, 4, 1, 0, 11, 10}, 0x8888AAAA},
{resolve_prom, MS, 7, {5, 4, 2, 3, 11, 10, 8, 9}, 0x8888AAAA},
{resolve_revprom, MS, 7, {6, 7, 4, 5, 0, 1, 10, 11}, 0xAAAA8888},
{resolve_revprom, MS, 7, {4, 5, 3, 2, 10, 11, 9, 8}, 0xAAAA8888},
// From sort of skewed offset 8-chain.
// It may have been a mistake to write these.
// {resolve_rlg, MS, 2, {6, 4, 11, 1, 0, 10, 5, 7}, 0x8A8AA8A8},
// {resolve_rlg, MS, 2, {4, 3, 5, 2, 11, 8, 10, 9}, 0x8A8AA8A8},
// {resolve_la, MS, 5, {4, 11, 1, 0, 10, 5, 7, 6}, 0xA8AA8A88},
// {resolve_la, MS, 5, {3, 2, 5, 10, 9, 8, 11, 4}, 0xAA8A88A8},
{resolve_rlg, MS, 1, {4, 5, 1, 0, 10, 11, 7, 6}, 0x31311313},
{resolve_rlg, MS, 1, {3, 2, 11, 10, 9, 8, 5, 4}, 0x31311313},
{resolve_la, MS, 4, {5, 1, 0, 10, 11, 7, 6, 4}, 0x13113133},
{resolve_la, MS, 4, {2, 11, 10, 9, 8, 5, 4, 3}, 0x13113133},
{resolve_none, MS, 0x10}};
static const resolve_tester test_4dmd_stuff[] = {
// These test for people in a miniwave as centers of the outer diamonds,
// while the others are facing each other as points. There are three of each
// to allow for the outsides to be symmetrical (points of the center diamonds)
// or unsymmetrical (points of a center diamond and the adjacent outer diamond).
{resolve_la, MS, 7, {8, 4, 5, 1, 0, 12, 13, 9}, 0x38A31A81},
{resolve_la, MS, 7, {9, 4, 5, 2, 1, 12, 13, 10}, 0x38A31A81},
{resolve_la, MS, 7, {10, 4, 5, 3, 2, 12, 13, 11}, 0x38A31A81},
{resolve_rlg, MS, 4, {9, 8, 5, 4, 1, 0, 13, 12}, 0x138A31A8},
{resolve_rlg, MS, 4, {10, 9, 5, 4, 2, 1, 13, 12}, 0x138A31A8},
{resolve_rlg, MS, 4, {11, 10, 5, 4, 3, 2, 13, 12}, 0x138A31A8},
{resolve_none, MS, 0x10}};
static const resolve_tester test_bigdmd_stuff[] = {
// From miniwaves in "common point diamonds".
{resolve_rlg, MS, 2, {7, 6, 3, 2, 1, 0, 9, 8}, 0x8A31A813},
{resolve_rlg, MS, 2, {4, 5, 3, 2, 10, 11, 9, 8}, 0x8A31A813},
{resolve_la, MS, 5, {7, 2, 3, 0, 1, 8, 9, 6}, 0xA31A8138},
{resolve_la, MS, 5, {4, 2, 3, 11, 10, 8, 9, 5}, 0xA31A8138},
{resolve_none, MS, 0x10}};
static const resolve_tester test_deepqtg_stuff[] = {
{resolve_circle, MS, 6, {11, 2, 1, 0, 5, 8, 7, 6}, 0x33AA1188},
{resolve_circle, MS, 7, {6, 11, 2, 1, 0, 5, 8, 7}, 0x833AA118},
{resolve_none, MS, 0x10}};
static const resolve_tester test_deepxwv_stuff[] = {
{resolve_rlg, MS, 4, {5, 8, 7, 6, 11, 2, 1, 0}, 0x138A31A8},
{resolve_la, MS, 7, {8, 6, 7, 11, 2, 0, 1, 5}, 0x38A31A81},
{resolve_none, MS, 0x10}};
static const resolve_tester test_d2x7_stuff[] = {
{resolve_rlg, MS, 4, {10, 9, 8, 7, 3, 2, 1, 0}, 0x138A31A8},
{resolve_rlg, MS, 4, {3, 4, 5, 6, 10, 11, 12, 13}, 0x138A31A8},
{resolve_prom, MS, 0, {10, 9, 8, 7, 3, 2, 1, 0}, 0x118833AA},
{resolve_prom, MS, 0, {3, 4, 5, 6, 10, 11, 12, 13}, 0x118833AA},
{resolve_la, MS, 7, {10, 7, 8, 2, 3, 0, 1, 9}, 0x38A31A81},
{resolve_la, MS, 7, {12, 4, 3, 6, 5, 11, 10, 13}, 0x8138A31A},
{resolve_none, MS, 0x10}};
static const resolve_tester test_3x6_stuff[] = {
{resolve_rlg, MS, 4, {12, 11, 7, 6, 3, 2, 16, 15}, 0x138A31A8},
{resolve_la, MS, 7, {11, 6, 7, 3, 2, 15, 16, 12}, 0x38A31A81},
{resolve_none, MS, 0x10}};
static const resolve_tester test_spindle_stuff[] = {
// These test for people looking around the corner.
{resolve_rlg, MS, 3, {4, 3, 2, 1, 0, 7, 6, 5}, 0x13313113},
{resolve_rlg, MS, 3, {4, 3, 2, 1, 0, 7, 6, 5}, 0x1A313813},
{resolve_la, MS, 7, {4, 3, 2, 1, 0, 7, 6, 5}, 0x33131131},
{resolve_la, MS, 7, {4, 3, 2, 1, 0, 7, 6, 5}, 0x38131A31},
{resolve_rlg, MS, 2, {3, 2, 1, 0, 7, 6, 5, 4}, 0x31311313},
{resolve_rlg, MS, 2, {3, 2, 1, 0, 7, 6, 5, 4}, 0x8131A313},
{resolve_la, MS, 6, {3, 2, 1, 0, 7, 6, 5, 4}, 0x33131131},
{resolve_la, MS, 6, {3, 2, 1, 0, 7, 6, 5, 4}, 0xA3138131},
{resolve_circle, MS, 7, {4, 3, 2, 1, 0, 7, 6, 5}, 0x83AAA188},
{resolve_circle, MS, 5, {3, 2, 1, 0, 7, 6, 5, 4}, 0x3AAA1888},
{resolve_none, MS, 0x10}};
static const resolve_tester test_2x4_stuff[] = {
// 8-chain.
{resolve_rlg, MS, 3, {5, 4, 3, 2, 1, 0, 7, 6}, 0x13313113},
{resolve_minigrand, MS, 5, {5, 0, 3, 6, 1, 4, 7, 2}, 0x11333311},
{resolve_la, MS, 6, {4, 3, 2, 1, 0, 7, 6, 5}, 0x33131131},
{resolve_pth_rlg, MS, 2, {5, 2, 3, 0, 1, 6, 7, 4}, 0x11313313},
{resolve_pth_la, MS, 5, {2, 3, 0, 1, 6, 7, 4, 5}, 0x13133131},
{resolve_bad_dixie_grand,DX, 1, {4, 1, 2, 7, 0, 5, 6, 3}, 0x33111133},
// Trade-by.
{resolve_rlg, MS, 2, {4, 3, 2, 1, 0, 7, 6, 5}, 0x11313313},
{resolve_minigrand, MS, 4, {4, 7, 2, 5, 0, 3, 6, 1}, 0x13333111},
{resolve_la, MS, 7, {5, 4, 3, 2, 1, 0, 7, 6}, 0x31131331},
{resolve_tby_rlg, MS, 3, {6, 3, 4, 1, 2, 7, 0, 5}, 0x11113333},
{resolve_tby_la, MS, 0, {5, 6, 3, 4, 1, 2, 7, 0}, 0x31111333},
// Waves.
{resolve_rlg, MS, 3, {5, 4, 2, 3, 1, 0, 6, 7}, 0x8A8AA8A8},
{resolve_minigrand, MS, 5, {5, 0, 2, 7, 1, 4, 6, 3}, 0x8888AAAA},
{resolve_la, MS, 6, {5, 3, 2, 0, 1, 7, 6, 4}, 0xA8AA8A88},
{resolve_ext_rlg, EX, 2, {5, 3, 2, 0, 1, 7, 6, 4}, 0x8A88A8AA},
{resolve_bad_ext_la, EX, 7, {5, 4, 2, 3, 1, 0, 6, 7}, 0xA8A88A8A},
{resolve_circ_rlg, MS, 1, {5, 0, 2, 7, 1, 4, 6, 3}, 0x8888AAAA},
{resolve_circ_la, MS, 0, {5, 7, 2, 4, 1, 3, 6, 0}, 0xAAA8888A},
{resolve_xby_rlg, XB, 2, {4, 2, 3, 1, 0, 6, 7, 5}, 0x8A88A8AA},
{resolve_xby_la, XB, 5, {3, 2, 0, 1, 7, 6, 4, 5}, 0xA88A8AA8},
{resolve_bad_dixie_grand,DX, 0x47,{3, 6, 0, 5, 7, 2, 4, 1}, 0xAA8888AA},
// From T-bone setup, ends facing.
{resolve_rlg, MS, 2, {4, 3, 2, 1, 0, 7, 6, 5}, 0x8A31A813},
{resolve_la, MS, 7, {5, 4, 3, 2, 1, 0, 7, 6}, 0x38A31A81},
{resolve_bad_dixie_grand,DX, 2, {5, 2, 3, 0, 1, 6, 7, 4}, 0x33AA1188},
// RLG from centers facing and ends in miniwaves.
{resolve_rlg, MS, 2, {4, 3, 2, 1, 0, 7, 6, 5}, 0x31311313},
// LA from lines-out. This has been decreed to be a horrible resolve.
{resolve_la, MS, 0x46,{4, 3, 2, 1, 0, 7, 6, 5}, 0xA8888AAA},
// Same thing, other gender.
{resolve_rlg, MS, 0x41,{3, 2, 1, 0, 7, 6, 5, 4}, 0x8888AAAA},
// From wacky T-bone.
{resolve_la, MS, 6, {4, 3, 2, 1, 0, 7, 6, 5}, 0x38131A31},
// From 2FL.
{resolve_prom, MS, 7, {5, 4, 2, 3, 1, 0, 6, 7}, 0x8888AAAA},
{resolve_revprom, MS, 5, {3, 2, 0, 1, 7, 6, 4, 5}, 0xAA8888AA},
// "circle left/right" from pseudo squared-set, normal.
{resolve_circle, MS, 6, {4, 3, 2, 1, 0, 7, 6, 5}, 0x33AA1188},
// "circle left/right" from pseudo squared-set, sashayed.
// If the circling distance is zero, that's fine. Resolve is "at home".
{resolve_circle, MS, 7, {5, 4, 3, 2, 1, 0, 7, 6}, 0x833AA118},
// "circle left/right" from lines-in, normal. The circling distance will always be nonzero.
{resolve_circle_from_facing_lines, MS, 7, {5, 4, 3, 2, 1, 0, 7, 6}, 0x88AAAA88},
// "circle left/right" from lines-in, sashayed. If the circling distance is zero,
// we don't actively seek this, because they aren't really squared up.
{resolve_circle_from_facing_lines, MS, 0x26,{4, 3, 2, 1, 0, 7, 6, 5}, 0x8AAAA888},
// From DPT.
{resolve_dixie_grand, DX, 2, {5, 2, 4, 7, 1, 6, 0, 3}, 0x33311113},
// From magic column.
{resolve_dixie_grand, DX, 3, {6, 3, 5, 0, 2, 7, 1, 4}, 0x33331111},
{resolve_dixie_grand, DX, 1, {4, 1, 3, 6, 0, 5, 7, 2}, 0x33111133},
// From columns.
{resolve_sglfileprom, MS, 7, {5, 4, 3, 2, 1, 0, 7, 6}, 0x11333311},
{resolve_sglfileprom, MS, 6, {4, 3, 2, 1, 0, 7, 6, 5}, 0x13333111},
{resolve_revsglfileprom, MS, 7, {5, 4, 3, 2, 1, 0, 7, 6}, 0x33111133},
{resolve_revsglfileprom, MS, 6, {4, 3, 2, 1, 0, 7, 6, 5}, 0x31111333},
// From T-bone.
{resolve_sglfileprom, MS, 7, {5, 4, 3, 2, 1, 0, 7, 6}, 0x18833AA1},
{resolve_sglfileprom, MS, 6, {4, 3, 2, 1, 0, 7, 6, 5}, 0x8833AA11},
{resolve_revsglfileprom, MS, 7, {5, 4, 3, 2, 1, 0, 7, 6}, 0x3AA11883},
{resolve_revsglfileprom, MS, 6, {4, 3, 2, 1, 0, 7, 6, 5}, 0xAA118833},
// From T-bone mixed 8-chain and waves.
{resolve_rlg, MS, 3, {5, 4, 2, 3, 1, 0, 6, 7}, 0x138A31A8},
{resolve_rlg, MS, 3, {5, 4, 3, 2, 1, 0, 7, 6}, 0x8A31A813},
{resolve_la, MS, 6, {4, 3, 2, 1, 0, 7, 6, 5}, 0x38A31A81},
{resolve_la, MS, 6, {5, 3, 2, 0, 1, 7, 6, 4}, 0xA31A8138},
// Singers only.
// Swing/prom from waves, boys looking in.
{resolve_rlg, MS, 0x13, {5, 4, 3, 2, 1, 0, 7, 6}, 0x8AA8A88A},
// Swing/prom from waves, girls looking in.
{resolve_rlg, MS, 0x13, {4, 5, 2, 3, 0, 1, 6, 7}, 0xA88A8AA8},
// Swing/prom from lines-out.
{resolve_rlg, MS, 0x13, {4, 5, 2, 3, 0, 1, 6, 7}, 0xAA8888AA},
// Same as cross-by-LA from waves (above), but it's mainstream here.
{resolve_rlg, MS, 0x11, {3, 2, 0, 1, 7, 6, 4, 5}, 0xA88A8AA8},
// 8-chain, boys in center.
{resolve_rlg, MS, 0x13, {5, 4, 2, 3, 1, 0, 6, 7}, 0x13133131},
// 8-chain, girls in center.
{resolve_rlg, MS, 0x11, {3, 2, 0, 1, 7, 6, 4, 5}, 0x31131331},
// Trade-by, ends sashayed.
{resolve_rlg, MS, 0x12, {4, 3, 1, 2, 0, 7, 5, 6}, 0x11133331},
// trade-by, centers sashayed.
{resolve_rlg, MS, 0x14, {6, 5, 3, 4, 2, 1, 7, 0}, 0x13113133},
// Dixie grand/swing/prom from DPT.
{resolve_singing_dixie_grand,DX,011, {4, 2, 1, 7, 0, 6, 5, 3}, 0x33111133},
{resolve_none, MS, 0x10}};
static const resolve_tester test_hrgl_stuff[] = {
{resolve_rlg, MS, 5, {6, 5, 7, 4, 2, 1, 3, 0}, 0xA3138131},
{resolve_la, MS, 1, {6, 5, 7, 4, 2, 1, 3, 0}, 0x8131A313},
{resolve_dixie_grand, DX, 4, {6, 4, 5, 3, 2, 0, 1, 7}, 0x8133A311},
{resolve_dixie_grand, DX, 4, {5, 2, 7, 0, 1, 6, 3, 4}, 0x38331A11},
{resolve_none, MS, 0x10}};
void configuration::calculate_resolve()
{
const resolve_tester *testptr;
int i;
uint32 singer_offset = 0;
if (ui_options.singing_call_mode == 1) singer_offset = 0600;
else if (ui_options.singing_call_mode == 2) singer_offset = 0200;
switch (state.kind) {
case s2x4:
testptr = test_2x4_stuff; break;
case s3x4:
testptr = test_3x4_stuff; break;
case s2x6:
testptr = test_2x6_stuff; break;
case s2x8:
testptr = test_2x8_stuff; break;
case s_qtag:
testptr = test_qtag_stuff; break;
case s_hrglass:
testptr = test_hrgl_stuff; break;
case s4dmd:
testptr = test_4dmd_stuff; break;
case sbigdmd:
testptr = test_bigdmd_stuff; break;
case sdeepqtg:
testptr = test_deepqtg_stuff; break;
case sdeepxwv:
testptr = test_deepxwv_stuff; break;
case sd2x7:
testptr = test_d2x7_stuff; break;
case s3x6:
testptr = test_3x6_stuff; break;
case s4x4:
testptr = test_4x4_stuff; break;
case s4x6:
testptr = test_4x6_stuff; break;
case s_c1phan:
testptr = test_c1phan_stuff; break;
case s_galaxy:
testptr = test_galaxy_stuff; break;
case s_crosswave: case s_thar:
// This makes use of the fact that the person numbering
// in crossed lines and thars is identical.
testptr = test_thar_stuff; break;
case s_rigger:
testptr = test_rigger_stuff; break;
case s_spindle:
testptr = test_spindle_stuff; break;
case s_alamo:
testptr = test_alamo_stuff; break;
default: goto no_resolve;
}
do {
uint32 directionword;
uint32 firstperson = state.people[testptr->locations[0]].id1 & 0700;
if (firstperson & 0100) goto not_this_one;
// We run the tests in descending order, because the test for i=0 is especially
// likely to pass (since the person ID is known to match), and we want to find
// failures as quickly as possible.
for (i=7,directionword=testptr->directions ; i>=0 ; i--,directionword>>=4) {
uint32 expected_id = (i << 6) + ((i&1) ? singer_offset : 0);
// The adds of "expected_id" and "firstperson" may overflow out of the "700" bits
// into the next 2 bits. (One bit for each add.)
if ((state.people[testptr->locations[i]].id1 ^
(expected_id + firstperson + (directionword & 0xF))) &
0777)
goto not_this_one;
}
if (calling_level < (dance_level) testptr->level_needed ||
(testptr->k == resolve_minigrand && !allowing_minigrand)) goto not_this_one;
resolve_flag.the_item = testptr;
resolve_flag.distance =
((state.rotation << 1) + (firstperson >> 6) + testptr->distance) & 7;
return;
not_this_one: ;
}
while (
// always do next one if it doesn't have the singer-only mark.
!((++testptr)->distance & 0x10) ||
// Even if it has the mark, do it if this is a singer
// and it isn't really the end of the table.
(ui_options.singing_call_mode != 0 && testptr->k != resolve_none));
// Too bad.
no_resolve:
init_resolve(); // Set it to the null resolve.
}
void ui_utils::write_aproximately()
{
if (configuration::current_config().state.result_flags.misc & RESULTFLAG__IMPRECISE_ROT)
writestuff("approximately ");
}
// This assumes that "sequence_is_resolved" passes.
void ui_utils::write_resolve_text(bool doing_file)
{
resolve_indicator & r = configuration::current_resolve();
int distance = r.distance;
resolve_kind index = r.the_item->k;
if (configuration::current_config().state.eighth_rotation)
distance++;
distance &= 7;
if (doing_file && !ui_options.singlespace_mode) doublespace_file();
if (index == resolve_circle || index == resolve_circle_from_facing_lines) {
if (distance == 0) {
if (index == resolve_circle_from_facing_lines) {
writestuff("in resolved facing lines with ");
write_aproximately();
writestuff("zero circling distance");
}
else {
write_aproximately();
writestuff("at home");
}
}
else {
writestuff("circle left ");
write_aproximately();
writestuff(resolve_distances[8 - distance]);
writestuff(" or right ");
write_aproximately();
writestuff(resolve_distances[distance]);
}
}
else {
first_part_kind first = resolve_table[index].first_part;
main_part_kind mainpart = resolve_table[index].main_part;
// In a singer, "pass thru, allemande left", "trade by, allemande left", or
// "cross by, allemande left" can be just "swing and promenade".
if (ui_options.singing_call_mode != 0) {
if (index == resolve_pth_la ||
index == resolve_tby_la ||
index == resolve_xby_la) {
first = first_part_none;
mainpart = main_part_swing;
}
else if (index == resolve_singing_dixie_grand) {
first = first_part_dixie;
mainpart = main_part_swing;
}
}
if (first != first_part_none) {
writestuff(resolve_first_parts[first]);
if (doing_file) {
newline();
if (!ui_options.singlespace_mode) doublespace_file();
}
else
writestuff(", ");
}
if (ui_options.singing_call_mode != 0 && mainpart == main_part_rlg) {
mainpart = main_part_swing;
distance ^= 4;
}
writestuff(resolve_main_parts[mainpart]);
writestuff(" (");
write_aproximately();
if (distance == 0) {
writestuff("at home)");
}
else {
if (index == resolve_revprom || index == resolve_revsglfileprom)
writestuff(resolve_distances[8 - distance]);
else
writestuff(resolve_distances[distance]);
writestuff(" promenade)");
}
}
}
// These variables are actually local to inner_search, but they are
// expected to be preserved across the throw, so they must be static.
static int perm_indices[8];
static int hashed_random_list[5];
static parse_block *inner_parse_mark, *outer_parse_mark;
static int history_insertion_point; // Where our resolve should lie in the history.
// This is normally the end of the history, but
// may be earlier if doing a reconcile. We clobber
// everything in the given history past this point.
static int history_save; // Where we are inserting calls now. This moves
// forward as we build multiple-call resolves.
#ifdef EXCESSIVE_RECONCILE_FIXUP
static uint32 global_status; // Yeah, it's sleazy making this static.
#endif
static bool inner_search(command_kind goal,
resolve_rec *new_resolve,
int insertion_depth,
int insertion_width)
{
int i, j;
uint32 directions, p, q;
int CLOCKS_TO_RESOLVE;
if (ui_options.resolve_test_minutes > 0)
CLOCKS_TO_RESOLVE = ui_options.resolve_test_minutes * 60 * CLOCKS_PER_SEC;
else
CLOCKS_TO_RESOLVE = 5*CLOCKS_PER_SEC;
history_insertion_point = huge_history_ptr;
if (goal == command_reconcile) {
history_insertion_point -= insertion_depth; // This now points to the end of the insertion region.
const setup & insertion_start_setup = configuration::history[history_insertion_point].state;
goal_rotation = insertion_start_setup.rotation;
goal_kind = insertion_start_setup.kind;
if (attr::klimit(goal_kind) != 7) return false;
for (j=0; j<8; j++)
goal_directions[j] = insertion_start_setup.people[j].id1 & d_mask;
for (j=0; j<8; j++) {
perm_indices[j] = -1;
for (i=0; i<8; i++)
if ((insertion_start_setup.people[i].id1 &
PID_MASK) ==
perm_array[j])
perm_indices[j] = i;
if (perm_indices[j] < 0) return false; // Didn't find the person????
}
history_insertion_point -= insertion_width; // Now it points to the beginning of the insertion region.
}
history_save = history_insertion_point;
// Since these variables are expected to be preserved
// across the throw, they must be volatile.
volatile int little_count = 0;
volatile int attempt_count = 0;
int attempt_start_time = clock();
hashed_random_list[0] = 0;
// Mark the parse block allocation, so that we throw away the garbage created by failing attempts.
inner_parse_mark = outer_parse_mark = get_parse_block_mark();
// This loop searches through a group of twenty single-call resolves, then a group
// of twenty two-call resolves, then a group of twenty three-call resolves,
// repeatedly. Any time it finds a resolve in less than the length of the sequence
// it is looking for, it of course accepts it. Why don't we simply always search
// for three call resolves and accept shorter ones that it might stumble upon?
// Because this might make the program "lazy": it would settle for long resolves
// rather than looking harder for short ones. We bias it in favor of short
// resolves by making it sometimes search only for short ones, refusing to look
// deeper when an attempt fails. The searches are in groups of twenty in order
// to save time: once we decide to search for some two-call resolves, we re-use