aboutsummaryrefslogtreecommitdiff
path: root/src/steps.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/steps.c')
-rw-r--r--src/steps.c177
1 files changed, 0 insertions, 177 deletions
diff --git a/src/steps.c b/src/steps.c
deleted file mode 100644
index cdba763..0000000
--- a/src/steps.c
+++ /dev/null
@@ -1,177 +0,0 @@
1#define STEPS_C
2
3#include "steps.h"
4
5/* TODO: change all checkers to use coordinates! */
6
7bool
8check_centers(Cube *cube)
9{
10 int i;
11
12 for (i = 0; i < 6; i++)
13 if (cube->xp[i] != i)
14 return false;
15
16 return true;
17}
18
19bool
20check_coud_HTM(Cube *cube)
21{
22 int i;
23
24 for (i = 0; i < 8; i++)
25 if (cube->co[i] != 0)
26 return false;
27
28 return true;
29}
30
31bool
32check_coud_URF(Cube *cube)
33{
34 Cube c2, c3;
35
36 copy_cube(cube, &c2);
37 copy_cube(cube, &c3);
38
39 apply_move(z, &c2);
40 apply_move(x, &c3);
41
42 return check_coud_HTM(cube) ||
43 check_coud_HTM(&c2) ||
44 check_coud_HTM(&c3);
45}
46
47bool
48check_cp_HTM(Cube *cube)
49{
50 int i;
51
52 for (i = 0; i < 8; i++)
53 if (cube->cp[i] != i)
54 return false;
55
56 return true;
57}
58
59bool
60check_corners_HTM(Cube *cube)
61{
62 return check_coud_HTM(cube) && check_cp_HTM(cube);
63}
64
65bool
66check_corners_URF(Cube *cube)
67{
68 Cube c;
69 Trans i;
70
71 for (i = 0; i < NROTATIONS; i++) {
72 copy_cube(cube, &c);
73 apply_alg(rotation_alg(i), &c);
74 if (check_corners_HTM(&c))
75 return true;
76 }
77
78 return false;
79}
80
81bool
82check_cornershtr(Cube *cube)
83{
84 /* TODO (use coord) */
85 return true;
86}
87
88bool
89check_eofb(Cube *cube)
90{
91 /* TODO (use coord) */
92 return true;
93}
94
95bool
96check_drud(Cube *cube)
97{
98 /* TODO (use coord) */
99 return true;
100}
101
102bool
103check_htr(Cube *cube)
104{
105 /* TODO (check_drud(cube) and coord_htr_drud == 0) */
106 return true;
107}
108
109Alg *
110validate_singlecw_ending(Alg *alg)
111{
112 int i;
113 bool nor, inv;
114 Alg *ret;
115 Move l2 = NULLMOVE, l1 = NULLMOVE, l2i = NULLMOVE, l1i = NULLMOVE;
116
117 for (i = 0; i < alg->len; i++) {
118 if (alg->inv[i]) {
119 l2i = l1i;
120 l1i = alg->move[i];
121 } else {
122 l2 = l1;
123 l1 = alg->move[i];
124 }
125 }
126
127 nor = l1 ==base_move(l1) && (!commute(l1, l2) ||l2 ==base_move(l2));
128 inv = l1i==base_move(l1i) && (!commute(l1i,l2i)||l2i==base_move(l2i));
129
130 if (nor && inv) {
131 ret = new_alg("");
132 copy_alg(alg, ret);
133 } else {
134 ret = NULL;
135 }
136
137 return ret;
138}
139
140/* Public functions **********************************************************/
141
142/*
143void
144compute_ind(Step *s, Cube *cube, Movable *ind)
145{
146 int i;
147 Cube mvd;
148 Trans t, tt;
149
150 for (i = 0; i < s->n_coord; i++) {
151 t = s->coord_trans[i];
152 copy_cube(cube, &mvd);
153 apply_trans(t, &mvd);
154
155 ind[i].val = index_coord(s->coord[i], &mvd, &tt);
156 ind[i].t = transform_trans(tt, t);
157 }
158}
159*/
160
161void
162prepare_cs(ChoiceStep *cs, SolveOptions *opts)
163{
164 int i, j;
165 Step *s;
166
167 for (i = 0; cs->step[i] != NULL; i++) {
168 s = cs->step[i];
169 for (j = 0; j < s->n_coord; j++) {
170 s->pd[j] = malloc(sizeof(PruneData));
171 s->pd[j]->moveset = s->moveset;
172 s->pd[j]->coord = s->coord[j];
173 s->pd[j]->compact = s->pd_compact[j];
174 s->pd[j] = genptable(s->pd[j], opts->nthreads);
175 }
176 }
177}

Generated with cgit - Back to sebastiano.tronto.net