aboutsummaryrefslogtreecommitdiff
path: root/src/cube.c
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-10-27 17:32:57 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2023-10-27 17:35:20 +0200
commitfabb1ae495c4404af0f26380c97d0bca7e881a27 (patch)
tree885b3f702e07e9864a85f5cd64911abd7ceeb5c2 /src/cube.c
parenta9cc2b9854e66f6a161ddf92c268897ee0435216 (diff)
downloadnissy-core-fabb1ae495c4404af0f26380c97d0bca7e881a27.tar.gz
nissy-core-fabb1ae495c4404af0f26380c97d0bca7e881a27.zip
more cleanup
Diffstat (limited to 'src/cube.c')
-rw-r--r--src/cube.c224
1 files changed, 2 insertions, 222 deletions
diff --git a/src/cube.c b/src/cube.c
index 0d97635..1e27de9 100644
--- a/src/cube.c
+++ b/src/cube.c
@@ -8,227 +8,7 @@
8 8
9#include "cube.h" 9#include "cube.h"
10 10
11#define _c_ufr 0U 11#include "_constants.c"
12#define _c_ubl 1U
13#define _c_dfl 2U
14#define _c_dbr 3U
15#define _c_ufl 4U
16#define _c_ubr 5U
17#define _c_dfr 6U
18#define _c_dbl 7U
19
20#define _e_uf 0U
21#define _e_ub 1U
22#define _e_db 2U
23#define _e_df 3U
24#define _e_ur 4U
25#define _e_ul 5U
26#define _e_dl 6U
27#define _e_dr 7U
28#define _e_fr 8U
29#define _e_fl 9U
30#define _e_bl 10U
31#define _e_br 11U
32
33#define _eoshift 4U
34#define _coshift 5U
35
36#define _pbits 0xFU
37#define _eobit 0x10U
38#define _cobits 0xF0U
39#define _cobits2 0x60U
40#define _ctwist_cw 0x20U
41#define _ctwist_ccw 0x40U
42#define _eflip 0x10U
43#define _error 0xFFU
44
45move_t inverse_move[] = {
46 [U] = U3,
47 [U2] = U2,
48 [U3] = U,
49 [D] = D3,
50 [D2] = D2,
51 [D3] = D,
52 [R] = R3,
53 [R2] = R2,
54 [R3] = R,
55 [L] = L3,
56 [L2] = L2,
57 [L3] = L,
58 [F] = F3,
59 [F2] = F2,
60 [F3] = F,
61 [B] = B3,
62 [B2] = B2,
63 [B3] = B,
64};
65
66trans_t inverse_trans[] = {
67 [UFr] = UFr,
68 [ULr] = URr,
69 [UBr] = UBr,
70 [URr] = URr,
71 [DFr] = DFr,
72 [DLr] = DLr,
73 [DRr] = DRr,
74 [DBr] = DBr,
75 [RUr] = FRr,
76 [RFr] = LFr,
77 [RDr] = BLr,
78 [RBr] = RBr,
79 [LUr] = FLr,
80 [LFr] = RFr,
81 [LDr] = BRr,
82 [LBr] = LBr,
83 [FUr] = FUr,
84 [FRr] = RUr,
85 [FDr] = BUr,
86 [FLr] = LUr,
87 [BUr] = FDr,
88 [BLr] = RDr,
89 [BDr] = BDr,
90 [BRr] = LDr,
91 [UFm] = UFm,
92 [ULm] = ULm,
93 [UBm] = UBm,
94 [URm] = ULm,
95 [DFm] = DFm,
96 [DLm] = DRm,
97 [DRm] = DLm,
98 [DBm] = DBm,
99 [RUm] = FLm,
100 [RFm] = RFm,
101 [RDm] = BRm,
102 [RBm] = LBm,
103 [LUm] = FRm,
104 [LFm] = LFm,
105 [LDm] = BLm,
106 [LBm] = RBm,
107 [FUm] = FUm,
108 [FRm] = LUm,
109 [FDm] = BUm,
110 [FLm] = RUm,
111 [BUm] = FDm,
112 [BLm] = LDm,
113 [BDm] = BDm,
114 [BRm] = RDm,
115};
116
117static char *cornerstr[] = {
118 [_c_ufr] = "UFR",
119 [_c_ubl] = "UBL",
120 [_c_dfl] = "DFL",
121 [_c_dbr] = "DBR",
122 [_c_ufl] = "UFL",
123 [_c_ubr] = "UBR",
124 [_c_dfr] = "DFR",
125 [_c_dbl] = "DBL"
126};
127
128static char *cornerstralt[] = {
129 [_c_ufr] = "URF",
130 [_c_ubl] = "ULB",
131 [_c_dfl] = "DLF",
132 [_c_dbr] = "DRB",
133 [_c_ufl] = "ULF",
134 [_c_ubr] = "URB",
135 [_c_dfr] = "DRF",
136 [_c_dbl] = "DLB"
137};
138
139static char *edgestr[] = {
140 [_e_uf] = "UF",
141 [_e_ub] = "UB",
142 [_e_db] = "DB",
143 [_e_df] = "DF",
144 [_e_ur] = "UR",
145 [_e_ul] = "UL",
146 [_e_dl] = "DL",
147 [_e_dr] = "DR",
148 [_e_fr] = "FR",
149 [_e_fl] = "FL",
150 [_e_bl] = "BL",
151 [_e_br] = "BR"
152};
153
154static char *movestr[] = {
155 [U] = "U",
156 [U2] = "U2",
157 [U3] = "U'",
158 [D] = "D",
159 [D2] = "D2",
160 [D3] = "D'",
161 [R] = "R",
162 [R2] = "R2",
163 [R3] = "R'",
164 [L] = "L",
165 [L2] = "L2",
166 [L3] = "L'",
167 [F] = "F",
168 [F2] = "F2",
169 [F3] = "F'",
170 [B] = "B",
171 [B2] = "B2",
172 [B3] = "B'",
173};
174
175static char *transstr[] = {
176 [UFr] = "rotation UF",
177 [UFm] = "mirrored UF",
178 [ULr] = "rotation UL",
179 [ULm] = "mirrored UL",
180 [UBr] = "rotation UB",
181 [UBm] = "mirrored UB",
182 [URr] = "rotation UR",
183 [URm] = "mirrored UR",
184 [DFr] = "rotation DF",
185 [DFm] = "mirrored DF",
186 [DLr] = "rotation DL",
187 [DLm] = "mirrored DL",
188 [DBr] = "rotation DB",
189 [DBm] = "mirrored DB",
190 [DRr] = "rotation DR",
191 [DRm] = "mirrored DR",
192 [RUr] = "rotation RU",
193 [RUm] = "mirrored RU",
194 [RFr] = "rotation RF",
195 [RFm] = "mirrored RF",
196 [RDr] = "rotation RD",
197 [RDm] = "mirrored RD",
198 [RBr] = "rotation RB",
199 [RBm] = "mirrored RB",
200 [LUr] = "rotation LU",
201 [LUm] = "mirrored LU",
202 [LFr] = "rotation LF",
203 [LFm] = "mirrored LF",
204 [LDr] = "rotation LD",
205 [LDm] = "mirrored LD",
206 [LBr] = "rotation LB",
207 [LBm] = "mirrored LB",
208 [FUr] = "rotation FU",
209 [FUm] = "mirrored FU",
210 [FRr] = "rotation FR",
211 [FRm] = "mirrored FR",
212 [FDr] = "rotation FD",
213 [FDm] = "mirrored FD",
214 [FLr] = "rotation FL",
215 [FLm] = "mirrored FL",
216 [BUr] = "rotation BU",
217 [BUm] = "mirrored BU",
218 [BRr] = "rotation BR",
219 [BRm] = "mirrored BR",
220 [BDr] = "rotation BD",
221 [BDm] = "mirrored BD",
222 [BLr] = "rotation BL",
223 [BLm] = "mirrored BL",
224};
225
226cube_t solvedcube = {
227 .c = {0, 1, 2, 3, 4, 5, 6, 7},
228 .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
229};
230
231static cube_t errorcube = { .e = {0}, .c = {0} };
232 12
233static bool isconsistent(cube_t); 13static bool isconsistent(cube_t);
234static cube_t flipallcorners(cube_t); 14static cube_t flipallcorners(cube_t);
@@ -966,7 +746,7 @@ flipallcorners(cube_t c)
966cube_t 746cube_t
967transform(cube_t c, trans_t t) 747transform(cube_t c, trans_t t)
968{ 748{
969#include "trans_move_arr.h" 749#include "_trans_move_arr.c"
970 750
971 cube_t ret; 751 cube_t ret;
972 752

Generated with cgit - Back to sebastiano.tronto.net