aboutsummaryrefslogtreecommitdiff
path: root/src/steps.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/steps.c')
-rw-r--r--src/steps.c246
1 files changed, 141 insertions, 105 deletions
diff --git a/src/steps.c b/src/steps.c
index c4d1279..014b206 100644
--- a/src/steps.c
+++ b/src/steps.c
@@ -36,8 +36,11 @@ static int estimate_drudfin_drud(DfsArg *arg);
36static int estimate_htr_drud(DfsArg *arg); 36static int estimate_htr_drud(DfsArg *arg);
37static int estimate_htrfin_htr(DfsArg *arg); 37static int estimate_htrfin_htr(DfsArg *arg);
38static int estimate_optimal_HTM(DfsArg *arg); 38static int estimate_optimal_HTM(DfsArg *arg);
39static int estimate_nxopt31_HTM(DfsArg *arg);
39static int estimate_light_HTM(DfsArg *arg); 40static int estimate_light_HTM(DfsArg *arg);
40 41
42static int estimate_nxoptlike(DfsArg *arg, PruneData *pd);
43
41static bool always_valid(Alg *alg); 44static bool always_valid(Alg *alg);
42static bool validate_singlecw_ending(Alg *alg); 45static bool validate_singlecw_ending(Alg *alg);
43 46
@@ -68,7 +71,7 @@ optimal_HTM = {
68 .ready = check_centers, 71 .ready = check_centers,
69 .ready_msg = check_centers_msg, 72 .ready_msg = check_centers_msg,
70 .is_valid = always_valid, 73 .is_valid = always_valid,
71 .moveset = moveset_HTM, 74 .moveset = &moveset_HTM,
72 75
73 .pre_trans = uf, 76 .pre_trans = uf,
74 77
@@ -77,6 +80,25 @@ optimal_HTM = {
77}; 80};
78 81
79Step 82Step
83optimal_nxopt31_HTM = {
84 .shortname = "nxopt31",
85 .name = "Optimal solve (in HTM), nxopt31 table",
86
87 .final = true,
88 .is_done = is_solved,
89 .estimate = estimate_nxopt31_HTM,
90 .ready = check_centers,
91 .ready_msg = check_centers_msg,
92 .is_valid = always_valid,
93 .moveset = &moveset_HTM,
94
95 .pre_trans = uf,
96
97 .tables = {&pd_nxopt31_HTM, &pd_corners_HTM},
98 .ntables = 2,
99};
100
101Step
80optimal_light_HTM = { 102optimal_light_HTM = {
81 .shortname = "light", 103 .shortname = "light",
82 .name = "Optimal solve (in HTM), small table (500Mb RAM total)", 104 .name = "Optimal solve (in HTM), small table (500Mb RAM total)",
@@ -87,7 +109,7 @@ optimal_light_HTM = {
87 .ready = check_centers, 109 .ready = check_centers,
88 .ready_msg = check_centers_msg, 110 .ready_msg = check_centers_msg,
89 .is_valid = always_valid, 111 .is_valid = always_valid,
90 .moveset = moveset_HTM, 112 .moveset = &moveset_HTM,
91 113
92 .pre_trans = uf, 114 .pre_trans = uf,
93 115
@@ -107,7 +129,7 @@ eoany_HTM = {
107 .ready = check_centers, 129 .ready = check_centers,
108 .ready_msg = check_centers_msg, 130 .ready_msg = check_centers_msg,
109 .is_valid = validate_singlecw_ending, 131 .is_valid = validate_singlecw_ending,
110 .moveset = moveset_HTM, 132 .moveset = &moveset_HTM,
111 133
112 .pre_trans = uf, 134 .pre_trans = uf,
113 135
@@ -126,7 +148,7 @@ eofb_HTM = {
126 .ready = check_centers, 148 .ready = check_centers,
127 .ready_msg = check_centers_msg, 149 .ready_msg = check_centers_msg,
128 .is_valid = validate_singlecw_ending, 150 .is_valid = validate_singlecw_ending,
129 .moveset = moveset_HTM, 151 .moveset = &moveset_HTM,
130 152
131 .pre_trans = uf, 153 .pre_trans = uf,
132 154
@@ -145,7 +167,7 @@ eorl_HTM = {
145 .ready = check_centers, 167 .ready = check_centers,
146 .ready_msg = check_centers_msg, 168 .ready_msg = check_centers_msg,
147 .is_valid = validate_singlecw_ending, 169 .is_valid = validate_singlecw_ending,
148 .moveset = moveset_HTM, 170 .moveset = &moveset_HTM,
149 171
150 .pre_trans = ur, 172 .pre_trans = ur,
151 173
@@ -164,7 +186,7 @@ eoud_HTM = {
164 .ready = check_centers, 186 .ready = check_centers,
165 .ready_msg = check_centers_msg, 187 .ready_msg = check_centers_msg,
166 .is_valid = validate_singlecw_ending, 188 .is_valid = validate_singlecw_ending,
167 .moveset = moveset_HTM, 189 .moveset = &moveset_HTM,
168 190
169 .pre_trans = fd, 191 .pre_trans = fd,
170 192
@@ -183,7 +205,7 @@ coany_HTM = {
183 .estimate = estimate_coany_HTM, 205 .estimate = estimate_coany_HTM,
184 .ready = NULL, 206 .ready = NULL,
185 .is_valid = validate_singlecw_ending, 207 .is_valid = validate_singlecw_ending,
186 .moveset = moveset_HTM, 208 .moveset = &moveset_HTM,
187 209
188 .pre_trans = uf, 210 .pre_trans = uf,
189 211
@@ -201,7 +223,7 @@ coud_HTM = {
201 .estimate = estimate_coud_HTM, 223 .estimate = estimate_coud_HTM,
202 .ready = NULL, 224 .ready = NULL,
203 .is_valid = validate_singlecw_ending, 225 .is_valid = validate_singlecw_ending,
204 .moveset = moveset_HTM, 226 .moveset = &moveset_HTM,
205 227
206 .pre_trans = uf, 228 .pre_trans = uf,
207 229
@@ -219,7 +241,7 @@ corl_HTM = {
219 .estimate = estimate_coud_HTM, 241 .estimate = estimate_coud_HTM,
220 .ready = NULL, 242 .ready = NULL,
221 .is_valid = validate_singlecw_ending, 243 .is_valid = validate_singlecw_ending,
222 .moveset = moveset_HTM, 244 .moveset = &moveset_HTM,
223 245
224 .pre_trans = rf, 246 .pre_trans = rf,
225 247
@@ -237,7 +259,7 @@ cofb_HTM = {
237 .estimate = estimate_coud_HTM, 259 .estimate = estimate_coud_HTM,
238 .ready = NULL, 260 .ready = NULL,
239 .is_valid = validate_singlecw_ending, 261 .is_valid = validate_singlecw_ending,
240 .moveset = moveset_HTM, 262 .moveset = &moveset_HTM,
241 263
242 .pre_trans = fd, 264 .pre_trans = fd,
243 265
@@ -255,7 +277,7 @@ coany_URF = {
255 .estimate = estimate_coany_URF, 277 .estimate = estimate_coany_URF,
256 .ready = NULL, 278 .ready = NULL,
257 .is_valid = validate_singlecw_ending, 279 .is_valid = validate_singlecw_ending,
258 .moveset = moveset_URF, 280 .moveset = &moveset_URF,
259 281
260 .pre_trans = uf, 282 .pre_trans = uf,
261 283
@@ -273,7 +295,7 @@ coud_URF = {
273 .estimate = estimate_coud_URF, 295 .estimate = estimate_coud_URF,
274 .ready = NULL, 296 .ready = NULL,
275 .is_valid = validate_singlecw_ending, 297 .is_valid = validate_singlecw_ending,
276 .moveset = moveset_URF, 298 .moveset = &moveset_URF,
277 299
278 .pre_trans = uf, 300 .pre_trans = uf,
279 301
@@ -291,7 +313,7 @@ corl_URF = {
291 .estimate = estimate_coud_URF, 313 .estimate = estimate_coud_URF,
292 .ready = NULL, 314 .ready = NULL,
293 .is_valid = validate_singlecw_ending, 315 .is_valid = validate_singlecw_ending,
294 .moveset = moveset_URF, 316 .moveset = &moveset_URF,
295 317
296 .pre_trans = rf, 318 .pre_trans = rf,
297 319
@@ -309,7 +331,7 @@ cofb_URF = {
309 .estimate = estimate_coud_URF, 331 .estimate = estimate_coud_URF,
310 .ready = NULL, 332 .ready = NULL,
311 .is_valid = validate_singlecw_ending, 333 .is_valid = validate_singlecw_ending,
312 .moveset = moveset_URF, 334 .moveset = &moveset_URF,
313 335
314 .pre_trans = fd, 336 .pre_trans = fd,
315 337
@@ -328,7 +350,7 @@ cornershtr_HTM = {
328 .estimate = estimate_cornershtr_HTM, 350 .estimate = estimate_cornershtr_HTM,
329 .ready = NULL, 351 .ready = NULL,
330 .is_valid = validate_singlecw_ending, 352 .is_valid = validate_singlecw_ending,
331 .moveset = moveset_HTM, 353 .moveset = &moveset_HTM,
332 354
333 .pre_trans = uf, 355 .pre_trans = uf,
334 356
@@ -346,7 +368,7 @@ cornershtr_URF = {
346 .estimate = estimate_cornershtr_URF, 368 .estimate = estimate_cornershtr_URF,
347 .ready = NULL, 369 .ready = NULL,
348 .is_valid = validate_singlecw_ending, 370 .is_valid = validate_singlecw_ending,
349 .moveset = moveset_URF, 371 .moveset = &moveset_URF,
350 372
351 .pre_trans = uf, 373 .pre_trans = uf,
352 374
@@ -364,7 +386,7 @@ corners_HTM = {
364 .estimate = estimate_corners_HTM, 386 .estimate = estimate_corners_HTM,
365 .ready = NULL, 387 .ready = NULL,
366 .is_valid = always_valid, 388 .is_valid = always_valid,
367 .moveset = moveset_HTM, 389 .moveset = &moveset_HTM,
368 390
369 .pre_trans = uf, 391 .pre_trans = uf,
370 392
@@ -382,7 +404,7 @@ corners_URF = {
382 .estimate = estimate_corners_URF, 404 .estimate = estimate_corners_URF,
383 .ready = NULL, 405 .ready = NULL,
384 .is_valid = always_valid, 406 .is_valid = always_valid,
385 .moveset = moveset_URF, 407 .moveset = &moveset_URF,
386 408
387 .pre_trans = uf, 409 .pre_trans = uf,
388 410
@@ -402,7 +424,7 @@ drany_HTM = {
402 .ready = check_centers, 424 .ready = check_centers,
403 .ready_msg = check_centers_msg, 425 .ready_msg = check_centers_msg,
404 .is_valid = validate_singlecw_ending, 426 .is_valid = validate_singlecw_ending,
405 .moveset = moveset_HTM, 427 .moveset = &moveset_HTM,
406 428
407 .pre_trans = uf, 429 .pre_trans = uf,
408 430
@@ -421,7 +443,7 @@ drud_HTM = {
421 .ready = check_centers, 443 .ready = check_centers,
422 .ready_msg = check_centers_msg, 444 .ready_msg = check_centers_msg,
423 .is_valid = validate_singlecw_ending, 445 .is_valid = validate_singlecw_ending,
424 .moveset = moveset_HTM, 446 .moveset = &moveset_HTM,
425 447
426 .pre_trans = uf, 448 .pre_trans = uf,
427 449
@@ -440,7 +462,7 @@ drrl_HTM = {
440 .ready = check_centers, 462 .ready = check_centers,
441 .ready_msg = check_centers_msg, 463 .ready_msg = check_centers_msg,
442 .is_valid = validate_singlecw_ending, 464 .is_valid = validate_singlecw_ending,
443 .moveset = moveset_HTM, 465 .moveset = &moveset_HTM,
444 466
445 .pre_trans = rf, 467 .pre_trans = rf,
446 468
@@ -459,7 +481,7 @@ drfb_HTM = {
459 .ready = check_centers, 481 .ready = check_centers,
460 .ready_msg = check_centers_msg, 482 .ready_msg = check_centers_msg,
461 .is_valid = validate_singlecw_ending, 483 .is_valid = validate_singlecw_ending,
462 .moveset = moveset_HTM, 484 .moveset = &moveset_HTM,
463 485
464 .pre_trans = fd, 486 .pre_trans = fd,
465 487
@@ -479,7 +501,7 @@ dr_eo = {
479 .ready = check_eofb, 501 .ready = check_eofb,
480 .ready_msg = check_eo_msg, 502 .ready_msg = check_eo_msg,
481 .is_valid = validate_singlecw_ending, 503 .is_valid = validate_singlecw_ending,
482 .moveset = moveset_eofb, 504 .moveset = &moveset_eofb,
483 505
484 .detect = detect_pretrans_eofb, 506 .detect = detect_pretrans_eofb,
485 507
@@ -498,7 +520,7 @@ dr_eofb = {
498 .ready = check_eofb, 520 .ready = check_eofb,
499 .ready_msg = check_eo_msg, 521 .ready_msg = check_eo_msg,
500 .is_valid = validate_singlecw_ending, 522 .is_valid = validate_singlecw_ending,
501 .moveset = moveset_eofb, 523 .moveset = &moveset_eofb,
502 524
503 .pre_trans = uf, 525 .pre_trans = uf,
504 526
@@ -517,7 +539,7 @@ dr_eorl = {
517 .ready = check_eofb, 539 .ready = check_eofb,
518 .ready_msg = check_eo_msg, 540 .ready_msg = check_eo_msg,
519 .is_valid = validate_singlecw_ending, 541 .is_valid = validate_singlecw_ending,
520 .moveset = moveset_eofb, 542 .moveset = &moveset_eofb,
521 543
522 .pre_trans = ur, 544 .pre_trans = ur,
523 545
@@ -536,7 +558,7 @@ dr_eoud = {
536 .ready = check_eofb, 558 .ready = check_eofb,
537 .ready_msg = check_eo_msg, 559 .ready_msg = check_eo_msg,
538 .is_valid = validate_singlecw_ending, 560 .is_valid = validate_singlecw_ending,
539 .moveset = moveset_eofb, 561 .moveset = &moveset_eofb,
540 562
541 .pre_trans = fd, 563 .pre_trans = fd,
542 564
@@ -555,7 +577,7 @@ drud_eofb = {
555 .ready = check_eofb, 577 .ready = check_eofb,
556 .ready_msg = check_eo_msg, 578 .ready_msg = check_eo_msg,
557 .is_valid = validate_singlecw_ending, 579 .is_valid = validate_singlecw_ending,
558 .moveset = moveset_eofb, 580 .moveset = &moveset_eofb,
559 581
560 .pre_trans = uf, 582 .pre_trans = uf,
561 583
@@ -574,7 +596,7 @@ drrl_eofb = {
574 .ready = check_eofb, 596 .ready = check_eofb,
575 .ready_msg = check_eo_msg, 597 .ready_msg = check_eo_msg,
576 .is_valid = validate_singlecw_ending, 598 .is_valid = validate_singlecw_ending,
577 .moveset = moveset_eofb, 599 .moveset = &moveset_eofb,
578 600
579 .pre_trans = rf, 601 .pre_trans = rf,
580 602
@@ -593,7 +615,7 @@ drud_eorl = {
593 .ready = check_eofb, 615 .ready = check_eofb,
594 .ready_msg = check_eo_msg, 616 .ready_msg = check_eo_msg,
595 .is_valid = validate_singlecw_ending, 617 .is_valid = validate_singlecw_ending,
596 .moveset = moveset_eofb, 618 .moveset = &moveset_eofb,
597 619
598 .pre_trans = ur, 620 .pre_trans = ur,
599 621
@@ -612,7 +634,7 @@ drfb_eorl = {
612 .ready = check_eofb, 634 .ready = check_eofb,
613 .ready_msg = check_eo_msg, 635 .ready_msg = check_eo_msg,
614 .is_valid = validate_singlecw_ending, 636 .is_valid = validate_singlecw_ending,
615 .moveset = moveset_eofb, 637 .moveset = &moveset_eofb,
616 638
617 .pre_trans = fr, 639 .pre_trans = fr,
618 640
@@ -631,7 +653,7 @@ drfb_eoud = {
631 .ready = check_eofb, 653 .ready = check_eofb,
632 .ready_msg = check_eo_msg, 654 .ready_msg = check_eo_msg,
633 .is_valid = validate_singlecw_ending, 655 .is_valid = validate_singlecw_ending,
634 .moveset = moveset_eofb, 656 .moveset = &moveset_eofb,
635 657
636 .pre_trans = fd, 658 .pre_trans = fd,
637 659
@@ -650,7 +672,7 @@ drrl_eoud = {
650 .ready = check_eofb, 672 .ready = check_eofb,
651 .ready_msg = check_eo_msg, 673 .ready_msg = check_eo_msg,
652 .is_valid = validate_singlecw_ending, 674 .is_valid = validate_singlecw_ending,
653 .moveset = moveset_eofb, 675 .moveset = &moveset_eofb,
654 676
655 .pre_trans = rd, 677 .pre_trans = rd,
656 678
@@ -670,7 +692,7 @@ dranyfin_DR = {
670 .ready = check_drud, 692 .ready = check_drud,
671 .ready_msg = check_drany_msg, 693 .ready_msg = check_drany_msg,
672 .is_valid = always_valid, 694 .is_valid = always_valid,
673 .moveset = moveset_drud, 695 .moveset = &moveset_drud,
674 696
675 .detect = detect_pretrans_drud, 697 .detect = detect_pretrans_drud,
676 698
@@ -689,7 +711,7 @@ drudfin_drud = {
689 .ready = check_drud, 711 .ready = check_drud,
690 .ready_msg = check_dr_msg, 712 .ready_msg = check_dr_msg,
691 .is_valid = always_valid, 713 .is_valid = always_valid,
692 .moveset = moveset_drud, 714 .moveset = &moveset_drud,
693 715
694 .pre_trans = uf, 716 .pre_trans = uf,
695 717
@@ -708,7 +730,7 @@ drrlfin_drrl = {
708 .ready = check_drud, 730 .ready = check_drud,
709 .ready_msg = check_dr_msg, 731 .ready_msg = check_dr_msg,
710 .is_valid = always_valid, 732 .is_valid = always_valid,
711 .moveset = moveset_drud, 733 .moveset = &moveset_drud,
712 734
713 .pre_trans = rf, 735 .pre_trans = rf,
714 736
@@ -727,7 +749,7 @@ drfbfin_drfb = {
727 .ready = check_drud, 749 .ready = check_drud,
728 .ready_msg = check_dr_msg, 750 .ready_msg = check_dr_msg,
729 .is_valid = always_valid, 751 .is_valid = always_valid,
730 .moveset = moveset_drud, 752 .moveset = &moveset_drud,
731 753
732 .pre_trans = fd, 754 .pre_trans = fd,
733 755
@@ -747,7 +769,7 @@ htr_any = {
747 .ready = check_drud, 769 .ready = check_drud,
748 .ready_msg = check_drany_msg, 770 .ready_msg = check_drany_msg,
749 .is_valid = validate_singlecw_ending, 771 .is_valid = validate_singlecw_ending,
750 .moveset = moveset_drud, 772 .moveset = &moveset_drud,
751 773
752 .detect = detect_pretrans_drud, 774 .detect = detect_pretrans_drud,
753 775
@@ -766,7 +788,7 @@ htr_drud = {
766 .ready = check_drud, 788 .ready = check_drud,
767 .ready_msg = check_dr_msg, 789 .ready_msg = check_dr_msg,
768 .is_valid = validate_singlecw_ending, 790 .is_valid = validate_singlecw_ending,
769 .moveset = moveset_drud, 791 .moveset = &moveset_drud,
770 792
771 .pre_trans = uf, 793 .pre_trans = uf,
772 794
@@ -785,7 +807,7 @@ htr_drrl = {
785 .ready = check_drud, 807 .ready = check_drud,
786 .ready_msg = check_dr_msg, 808 .ready_msg = check_dr_msg,
787 .is_valid = validate_singlecw_ending, 809 .is_valid = validate_singlecw_ending,
788 .moveset = moveset_drud, 810 .moveset = &moveset_drud,
789 811
790 .pre_trans = rf, 812 .pre_trans = rf,
791 813
@@ -804,7 +826,7 @@ htr_drfb = {
804 .ready = check_drud, 826 .ready = check_drud,
805 .ready_msg = check_dr_msg, 827 .ready_msg = check_dr_msg,
806 .is_valid = validate_singlecw_ending, 828 .is_valid = validate_singlecw_ending,
807 .moveset = moveset_drud, 829 .moveset = &moveset_drud,
808 830
809 .pre_trans = fd, 831 .pre_trans = fd,
810 832
@@ -824,7 +846,7 @@ htrfin_htr = {
824 .ready = check_htr, 846 .ready = check_htr,
825 .ready_msg = check_htr_msg, 847 .ready_msg = check_htr_msg,
826 .is_valid = always_valid, 848 .is_valid = always_valid,
827 .moveset = moveset_htr, 849 .moveset = &moveset_htr,
828 850
829 .pre_trans = uf, 851 .pre_trans = uf,
830 852
@@ -834,6 +856,7 @@ htrfin_htr = {
834 856
835Step *steps[NSTEPS] = { 857Step *steps[NSTEPS] = {
836 &optimal_HTM, /* first is default */ 858 &optimal_HTM, /* first is default */
859 &optimal_nxopt31_HTM,
837 &optimal_light_HTM, 860 &optimal_light_HTM,
838 861
839 &eoany_HTM, 862 &eoany_HTM,
@@ -1183,6 +1206,19 @@ estimate_htrfin_htr(DfsArg *arg)
1183static int 1206static int
1184estimate_optimal_HTM(DfsArg *arg) 1207estimate_optimal_HTM(DfsArg *arg)
1185{ 1208{
1209 return estimate_nxoptlike(arg, &pd_khuge_HTM);
1210}
1211
1212static int
1213estimate_nxopt31_HTM(DfsArg *arg)
1214{
1215 return estimate_nxoptlike(arg, &pd_nxopt31_HTM);
1216}
1217
1218/* TODO: also use generic procedure for this */
1219static int
1220estimate_light_HTM(DfsArg *arg)
1221{
1186 int target, ret; 1222 int target, ret;
1187 Cube aux; 1223 Cube aux;
1188 1224
@@ -1192,6 +1228,9 @@ estimate_optimal_HTM(DfsArg *arg)
1192 (1<<L) | (1<<L2) | (1<<L3); 1228 (1<<L) | (1<<L2) | (1<<L3);
1193 static const uint64_t fbmask = (1<<F) | (1<<F2) | (1<<F3) | 1229 static const uint64_t fbmask = (1<<F) | (1<<F2) | (1<<F3) |
1194 (1<<B) | (1<<B2) | (1<<B3); 1230 (1<<B) | (1<<B2) | (1<<B3);
1231 static const uint64_t htmask = (1<<U2) | (1<<D2) |
1232 (1<<R2) | (1<<L2) |
1233 (1<<F2) | (1<<B2);
1195 1234
1196 ret = -1; 1235 ret = -1;
1197 target = arg->d - arg->current_alg->len; 1236 target = arg->d - arg->current_alg->len;
@@ -1204,18 +1243,18 @@ estimate_optimal_HTM(DfsArg *arg)
1204 UPDATECHECKSTOP(ret, arg->ed->corners, target); 1243 UPDATECHECKSTOP(ret, arg->ed->corners, target);
1205 1244
1206 /* Normal probing */ 1245 /* Normal probing */
1207 arg->ed->normal_ud = ptableval(&pd_khuge_HTM, arg->cube); 1246 arg->ed->normal_ud = ptableval(&pd_drud_sym16_HTM, arg->cube);
1208 UPDATECHECKSTOP(ret, arg->ed->normal_ud, target); 1247 UPDATECHECKSTOP(ret, arg->ed->normal_ud, target);
1209 aux = apply_trans(fd, arg->cube); 1248 aux = apply_trans(fd, arg->cube);
1210 arg->ed->normal_fb = ptableval(&pd_khuge_HTM, aux); 1249 arg->ed->normal_fb = ptableval(&pd_drud_sym16_HTM, aux);
1211 UPDATECHECKSTOP(ret, arg->ed->normal_fb, target); 1250 UPDATECHECKSTOP(ret, arg->ed->normal_fb, target);
1212 aux = apply_trans(rf, arg->cube); 1251 aux = apply_trans(rf, arg->cube);
1213 arg->ed->normal_rl = ptableval(&pd_khuge_HTM, aux); 1252 arg->ed->normal_rl = ptableval(&pd_drud_sym16_HTM, aux);
1214 UPDATECHECKSTOP(ret, arg->ed->normal_rl, target); 1253 UPDATECHECKSTOP(ret, arg->ed->normal_rl, target);
1215 1254
1216 /* If ret == 0, it's solved (corners + triple slice solved) */ 1255 /* If ret == 0, it's solved (corners + triple slice solved) */
1217 if (ret == 0) 1256 if (ret == 0)
1218 return 0; 1257 return is_solved(arg->cube) ? 0 : 1;
1219 1258
1220 /* Michel de Bondt's trick*/ 1259 /* Michel de Bondt's trick*/
1221 if (arg->ed->normal_ud == arg->ed->normal_fb && 1260 if (arg->ed->normal_ud == arg->ed->normal_fb &&
@@ -1224,21 +1263,30 @@ estimate_optimal_HTM(DfsArg *arg)
1224 } 1263 }
1225 1264
1226 /* Inverse probing */ 1265 /* Inverse probing */
1227 aux = arg->inverse = inverse_cube(arg->cube); 1266 if (!((1<<arg->last1) & htmask)) {
1228 if (!((1<<arg->last1) & udmask) || (arg->ed->inverse_ud == -1)) { 1267 aux = arg->inverse = inverse_cube(arg->cube);
1229 arg->ed->inverse_ud = ptableval(&pd_khuge_HTM, aux); 1268 if (!((1<<arg->last1) & udmask) || (arg->ed->inverse_ud==-1)) {
1230 } 1269 arg->ed->inverse_ud =
1231 UPDATECHECKSTOP(ret, arg->ed->inverse_ud, target); 1270 ptableval(&pd_drud_sym16_HTM, aux);
1232 if (!((1<<arg->last1) & fbmask) || (arg->ed->inverse_fb == -1)) { 1271 }
1233 aux = apply_trans(fd, arg->inverse); 1272 UPDATECHECKSTOP(ret, arg->ed->inverse_ud, target);
1234 arg->ed->inverse_fb = ptableval(&pd_khuge_HTM, aux); 1273 if (!((1<<arg->last1) & fbmask) || (arg->ed->inverse_fb==-1)) {
1235 } 1274 aux = apply_trans(fd, arg->inverse);
1236 UPDATECHECKSTOP(ret, arg->ed->inverse_fb, target); 1275 arg->ed->inverse_fb =
1237 if (!((1<<arg->last1) & rlmask) || (arg->ed->inverse_rl == -1)) { 1276 ptableval(&pd_drud_sym16_HTM, aux);
1238 aux = apply_trans(rf, arg->inverse); 1277 }
1239 arg->ed->inverse_rl = ptableval(&pd_khuge_HTM, aux); 1278 UPDATECHECKSTOP(ret, arg->ed->inverse_fb, target);
1279 if (!((1<<arg->last1) & rlmask) || (arg->ed->inverse_rl==-1)) {
1280 aux = apply_trans(rf, arg->inverse);
1281 arg->ed->inverse_rl =
1282 ptableval(&pd_drud_sym16_HTM, aux);
1283 }
1284 UPDATECHECKSTOP(ret, arg->ed->inverse_rl, target);
1285 } else {
1286 UPDATECHECKSTOP(ret, arg->ed->inverse_ud, target);
1287 UPDATECHECKSTOP(ret, arg->ed->inverse_fb, target);
1288 UPDATECHECKSTOP(ret, arg->ed->inverse_rl, target);
1240 } 1289 }
1241 UPDATECHECKSTOP(ret, arg->ed->inverse_rl, target);
1242 1290
1243 /* Michel de Bondt's trick*/ 1291 /* Michel de Bondt's trick*/
1244 if (arg->ed->inverse_ud == arg->ed->inverse_fb && 1292 if (arg->ed->inverse_ud == arg->ed->inverse_fb &&
@@ -1246,26 +1294,26 @@ estimate_optimal_HTM(DfsArg *arg)
1246 UPDATECHECKSTOP(ret, arg->ed->inverse_ud + 1, target); 1294 UPDATECHECKSTOP(ret, arg->ed->inverse_ud + 1, target);
1247 } 1295 }
1248 1296
1249 /* nxopt trick */ 1297 /* nxopt trick + half turn trick */
1250 if (arg->ed->normal_ud == target) 1298 if (arg->ed->normal_ud == target)
1251 arg->badmovesinv |= udmask; 1299 arg->badmovesinv |= udmask | htmask;
1252 if (arg->ed->normal_fb == target) 1300 if (arg->ed->normal_fb == target)
1253 arg->badmovesinv |= fbmask; 1301 arg->badmovesinv |= fbmask | htmask;
1254 if (arg->ed->normal_rl == target) 1302 if (arg->ed->normal_rl == target)
1255 arg->badmovesinv |= rlmask; 1303 arg->badmovesinv |= rlmask | htmask;
1256 1304
1257 if (arg->ed->inverse_ud == target) 1305 if (arg->ed->inverse_ud == target)
1258 arg->badmoves |= udmask; 1306 arg->badmoves |= udmask | htmask;
1259 if (arg->ed->inverse_fb == target) 1307 if (arg->ed->inverse_fb == target)
1260 arg->badmoves |= fbmask; 1308 arg->badmoves |= fbmask | htmask;
1261 if (arg->ed->inverse_rl == target) 1309 if (arg->ed->inverse_rl == target)
1262 arg->badmoves |= rlmask; 1310 arg->badmoves |= rlmask | htmask;
1263 1311
1264 return arg->ed->oldret = ret; 1312 return arg->ed->oldret = ret;
1265} 1313}
1266 1314
1267static int 1315static int
1268estimate_light_HTM(DfsArg *arg) 1316estimate_nxoptlike(DfsArg *arg, PruneData *pd)
1269{ 1317{
1270 int target, ret; 1318 int target, ret;
1271 Cube aux; 1319 Cube aux;
@@ -1276,9 +1324,6 @@ estimate_light_HTM(DfsArg *arg)
1276 (1<<L) | (1<<L2) | (1<<L3); 1324 (1<<L) | (1<<L2) | (1<<L3);
1277 static const uint64_t fbmask = (1<<F) | (1<<F2) | (1<<F3) | 1325 static const uint64_t fbmask = (1<<F) | (1<<F2) | (1<<F3) |
1278 (1<<B) | (1<<B2) | (1<<B3); 1326 (1<<B) | (1<<B2) | (1<<B3);
1279 static const uint64_t htmask = (1<<U2) | (1<<D2) |
1280 (1<<R2) | (1<<L2) |
1281 (1<<F2) | (1<<B2);
1282 1327
1283 ret = -1; 1328 ret = -1;
1284 target = arg->d - arg->current_alg->len; 1329 target = arg->d - arg->current_alg->len;
@@ -1291,18 +1336,17 @@ estimate_light_HTM(DfsArg *arg)
1291 UPDATECHECKSTOP(ret, arg->ed->corners, target); 1336 UPDATECHECKSTOP(ret, arg->ed->corners, target);
1292 1337
1293 /* Normal probing */ 1338 /* Normal probing */
1294 arg->ed->normal_ud = ptableval(&pd_drud_sym16_HTM, arg->cube); 1339 arg->ed->normal_ud = ptableval(pd, arg->cube);
1295 UPDATECHECKSTOP(ret, arg->ed->normal_ud, target); 1340 UPDATECHECKSTOP(ret, arg->ed->normal_ud, target);
1296 aux = apply_trans(fd, arg->cube); 1341 aux = apply_trans(fd, arg->cube);
1297 arg->ed->normal_fb = ptableval(&pd_drud_sym16_HTM, aux); 1342 arg->ed->normal_fb = ptableval(pd, aux);
1298 UPDATECHECKSTOP(ret, arg->ed->normal_fb, target); 1343 UPDATECHECKSTOP(ret, arg->ed->normal_fb, target);
1299 aux = apply_trans(rf, arg->cube); 1344 aux = apply_trans(rf, arg->cube);
1300 arg->ed->normal_rl = ptableval(&pd_drud_sym16_HTM, aux); 1345 arg->ed->normal_rl = ptableval(pd, aux);
1301 UPDATECHECKSTOP(ret, arg->ed->normal_rl, target); 1346 UPDATECHECKSTOP(ret, arg->ed->normal_rl, target);
1302 1347
1303 /* If ret == 0, it's solved (corners + triple slice solved) */
1304 if (ret == 0) 1348 if (ret == 0)
1305 return 0; 1349 return arg->step->is_done(arg->cube) ? 0 : 1;
1306 1350
1307 /* Michel de Bondt's trick*/ 1351 /* Michel de Bondt's trick*/
1308 if (arg->ed->normal_ud == arg->ed->normal_fb && 1352 if (arg->ed->normal_ud == arg->ed->normal_fb &&
@@ -1311,30 +1355,21 @@ estimate_light_HTM(DfsArg *arg)
1311 } 1355 }
1312 1356
1313 /* Inverse probing */ 1357 /* Inverse probing */
1314 if (!((1<<arg->last1) & htmask)) { 1358 aux = arg->inverse = inverse_cube(arg->cube);
1315 aux = arg->inverse = inverse_cube(arg->cube); 1359 if (!((1<<arg->last1) & udmask) || (arg->ed->inverse_ud == -1)) {
1316 if (!((1<<arg->last1) & udmask) || (arg->ed->inverse_ud==-1)) { 1360 arg->ed->inverse_ud = ptableval(pd, aux);
1317 arg->ed->inverse_ud = 1361 }
1318 ptableval(&pd_drud_sym16_HTM, aux); 1362 UPDATECHECKSTOP(ret, arg->ed->inverse_ud, target);
1319 } 1363 if (!((1<<arg->last1) & fbmask) || (arg->ed->inverse_fb == -1)) {
1320 UPDATECHECKSTOP(ret, arg->ed->inverse_ud, target); 1364 aux = apply_trans(fd, arg->inverse);
1321 if (!((1<<arg->last1) & fbmask) || (arg->ed->inverse_fb==-1)) { 1365 arg->ed->inverse_fb = ptableval(pd, aux);
1322 aux = apply_trans(fd, arg->inverse); 1366 }
1323 arg->ed->inverse_fb = 1367 UPDATECHECKSTOP(ret, arg->ed->inverse_fb, target);
1324 ptableval(&pd_drud_sym16_HTM, aux); 1368 if (!((1<<arg->last1) & rlmask) || (arg->ed->inverse_rl == -1)) {
1325 } 1369 aux = apply_trans(rf, arg->inverse);
1326 UPDATECHECKSTOP(ret, arg->ed->inverse_fb, target); 1370 arg->ed->inverse_rl = ptableval(pd, aux);
1327 if (!((1<<arg->last1) & rlmask) || (arg->ed->inverse_rl==-1)) {
1328 aux = apply_trans(rf, arg->inverse);
1329 arg->ed->inverse_rl =
1330 ptableval(&pd_drud_sym16_HTM, aux);
1331 }
1332 UPDATECHECKSTOP(ret, arg->ed->inverse_rl, target);
1333 } else {
1334 UPDATECHECKSTOP(ret, arg->ed->inverse_ud, target);
1335 UPDATECHECKSTOP(ret, arg->ed->inverse_fb, target);
1336 UPDATECHECKSTOP(ret, arg->ed->inverse_rl, target);
1337 } 1371 }
1372 UPDATECHECKSTOP(ret, arg->ed->inverse_rl, target);
1338 1373
1339 /* Michel de Bondt's trick*/ 1374 /* Michel de Bondt's trick*/
1340 if (arg->ed->inverse_ud == arg->ed->inverse_fb && 1375 if (arg->ed->inverse_ud == arg->ed->inverse_fb &&
@@ -1342,24 +1377,25 @@ estimate_light_HTM(DfsArg *arg)
1342 UPDATECHECKSTOP(ret, arg->ed->inverse_ud + 1, target); 1377 UPDATECHECKSTOP(ret, arg->ed->inverse_ud + 1, target);
1343 } 1378 }
1344 1379
1345 /* nxopt trick + half turn trick */ 1380 /* nxopt trick */
1346 if (arg->ed->normal_ud == target) 1381 if (arg->ed->normal_ud == target)
1347 arg->badmovesinv |= udmask | htmask; 1382 arg->badmovesinv |= udmask;
1348 if (arg->ed->normal_fb == target) 1383 if (arg->ed->normal_fb == target)
1349 arg->badmovesinv |= fbmask | htmask; 1384 arg->badmovesinv |= fbmask;
1350 if (arg->ed->normal_rl == target) 1385 if (arg->ed->normal_rl == target)
1351 arg->badmovesinv |= rlmask | htmask; 1386 arg->badmovesinv |= rlmask;
1352 1387
1353 if (arg->ed->inverse_ud == target) 1388 if (arg->ed->inverse_ud == target)
1354 arg->badmoves |= udmask | htmask; 1389 arg->badmoves |= udmask;
1355 if (arg->ed->inverse_fb == target) 1390 if (arg->ed->inverse_fb == target)
1356 arg->badmoves |= fbmask | htmask; 1391 arg->badmoves |= fbmask;
1357 if (arg->ed->inverse_rl == target) 1392 if (arg->ed->inverse_rl == target)
1358 arg->badmoves |= rlmask | htmask; 1393 arg->badmoves |= rlmask;
1359 1394
1360 return arg->ed->oldret = ret; 1395 return arg->ed->oldret = ret;
1361} 1396}
1362 1397
1398
1363static bool 1399static bool
1364always_valid(Alg *alg) 1400always_valid(Alg *alg)
1365{ 1401{

Generated with cgit - Back to sebastiano.tronto.net