aboutsummaryrefslogtreecommitdiff
path: root/adhoc/cornersdrhtr.c
diff options
context:
space:
mode:
Diffstat (limited to 'adhoc/cornersdrhtr.c')
-rw-r--r--adhoc/cornersdrhtr.c128
1 files changed, 0 insertions, 128 deletions
diff --git a/adhoc/cornersdrhtr.c b/adhoc/cornersdrhtr.c
deleted file mode 100644
index 2a5a6e6..0000000
--- a/adhoc/cornersdrhtr.c
+++ /dev/null
@@ -1,128 +0,0 @@
1#include "commands.h"
2
3/* Some of the following functions are new, some are copied from steps.c */
4bool
5allowed(Move m)
6{
7 return base_move(m) == U || m == R2 || m == F2;
8}
9
10bool
11allowed_next(Move l2, Move l1, Move m)
12{
13 return base_move(m) != base_move(l1);
14}
15
16bool
17check_cornershtr(Cube c)
18{
19 return coord_cornershtr.index(c) == 0;
20}
21
22bool
23check_coud_and_dbl(Cube c)
24{
25 return c.coud == 0 && what_corner_at(c, DBL) == DBL;
26}
27
28static int
29estimate_cornershtr_HTM(DfsArg *arg)
30{
31 return ptableval(&pd_cornershtr_HTM, arg->cube);
32}
33
34static bool
35validate_singlecw_ending(Alg *alg)
36{
37 int i;
38 bool nor, inv;
39 Move l2 = NULLMOVE, l1 = NULLMOVE, l2i = NULLMOVE, l1i = NULLMOVE;
40
41 for (i = 0; i < alg->len; i++) {
42 if (alg->inv[i]) {
43 l2i = l1i;
44 l1i = alg->move[i];
45 } else {
46 l2 = l1;
47 l1 = alg->move[i];
48 }
49 }
50
51 nor = l1 ==base_move(l1) && (!commute(l1, l2) ||l2 ==base_move(l2));
52 inv = l1i==base_move(l1i) && (!commute(l1i,l2i)||l2i==base_move(l2i));
53
54 return nor && inv;
55}
56
57int
58main()
59{
60 Moveset moveset_UR2F2 = {
61 .allowed = allowed,
62 .allowed_next = allowed_next,
63 };
64
65 init_moveset(&moveset_UR2F2);
66
67 /*
68 * This step is the same as cornershtr_HTM in steps.c, except for
69 * the ready() function (which is not relevant anyway, it is there
70 * more for testing than anything else) and the moveset.
71 */
72 Step step = {
73 .final = false,
74 .is_done = check_cornershtr,
75 .estimate = estimate_cornershtr_HTM,
76 .ready = check_coud_and_dbl,
77 .is_valid = validate_singlecw_ending,
78 .moveset = &moveset_UR2F2,
79
80 .pre_trans = uf,
81
82 .tables = {&pd_cornershtr_HTM},
83 .ntables = 1,
84 };
85
86 SolveOptions opts = {
87 .min_moves = 0,
88 .max_moves = 20,
89 .max_solutions = 1,
90 .nthreads = 4,
91 .optimal = 0,
92 .can_niss = false,
93 .verbose = false,
94 .all = false,
95 .print_number = false,
96 .count_only = false
97 };
98
99 init_symcoord();
100
101 bool cphtr_state_done[BINOM8ON4*6];
102 for (unsigned long int i = 0; i < BINOM8ON4*6; i++)
103 cphtr_state_done[i] = false;
104
105 for (unsigned long int i = 0; i < FACTORIAL8; i++) {
106 AlgList *sols;
107 Cube c = {0};
108 c.cp = i; /* inconsistent state because of side CO */
109
110 if (what_corner_at(c, DBL) != DBL ||
111 cphtr_state_done[coord_cphtr.index(c)])
112 continue;
113
114 fprintf(stderr, "Doing cp %ld (cphtr state %ld)\n",
115 i, coord_cphtr.index(c));
116
117 cphtr_state_done[coord_cphtr.index(c)] = true;
118 /* Comment next two lines to get non-reduced list */
119 Cube mirror = apply_trans(ur_mirror, c);
120 cphtr_state_done[coord_cphtr.index(mirror)] = true;
121
122 sols = solve(c, &step, &opts);
123 printf("%.2d\t", sols->first->alg->len);
124 print_alglist(sols, opts.print_number);
125 }
126
127 return 0;
128}

Generated with cgit - Back to sebastiano.tronto.net