aboutsummaryrefslogtreecommitdiff
path: root/src/coord.h
blob: 4cd7e476c328163d66105048603985b7d28cef5c (plain)
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
#ifndef COORD_H
#define COORD_H

#include "trans.h"

void                    gen_coord(Coordinate *coord);
uint64_t                index_coord(Coordinate *coord, Cube *cube,
                            Trans *offtrans);
uint64_t                indexers_getind(Indexer **is, Cube *c);
void                    indexers_makecube(Indexer **is, uint64_t ind, Cube *c);
uint64_t                move_coord(Coordinate *coord, Move m,
                            uint64_t ind, Trans *offtrans);
uint64_t                trans_coord(Coordinate *coord, Trans t, uint64_t ind);

/* Base coordinates and their index functions ********************************/

#ifndef COORD_C

extern Coordinate coord_eofb;
extern Coordinate coord_coud;
extern Coordinate coord_cp;
extern Coordinate coord_cpudsep;
extern Coordinate coord_epos;
extern Coordinate coord_epe;
extern Coordinate coord_eposepe;
extern Coordinate coord_epud;
extern Coordinate coord_eofbepos;
extern Coordinate coord_coud_cpudsep;
extern Coordinate coord_eofbepos_sym16;
extern Coordinate coord_cp_sym16;
extern Coordinate coord_corners_sym16;
extern Coordinate coord_drud_sym16;
extern Coordinate coord_drudfin_noE_sym16;
extern Coordinate coord_nxopt31;

extern Coordinate *all_coordinates[];

#else

/* Indexers ******************************************************************/

uint64_t index_eofb(Cube *cube);
void     invindex_eofb(uint64_t ind, Cube *ret);
Indexer
i_eofb = {
	.n       = POW2TO11,
	.index   = index_eofb,
	.to_cube = invindex_eofb,
};

uint64_t index_coud(Cube *cube);
void     invindex_coud(uint64_t ind, Cube *ret);
Indexer
i_coud = {
	.n       = POW3TO7,
	.index   = index_coud,
	.to_cube = invindex_coud,
};

uint64_t index_cp(Cube *cube);
void     invindex_cp(uint64_t ind, Cube *ret);
Indexer
i_cp = {
	.n       = FACTORIAL8,
	.index   = index_cp,
	.to_cube = invindex_cp,
};

uint64_t index_cpudsep(Cube *cube);
void     invindex_cpudsep(uint64_t ind, Cube *ret);
Indexer
i_cpudsep = {
	.n       = BINOM8ON4,
	.index   = index_cpudsep,
	.to_cube = invindex_cpudsep,
};

uint64_t index_epos(Cube *cube);
void     invindex_epos(uint64_t ind, Cube *ret);
Indexer
i_epos = {
	.n       = BINOM12ON4,
	.index   = index_epos,
	.to_cube = invindex_epos,
};

uint64_t index_epe(Cube *cube);
void     invindex_epe(uint64_t ind, Cube *ret);
Indexer
i_epe = {
	.n       = FACTORIAL4,
	.index   = index_epe,
	.to_cube = invindex_epe,
};

uint64_t index_eposepe(Cube *cube);
void     invindex_eposepe(uint64_t ind, Cube *ret);
Indexer
i_eposepe = {
	.n       = BINOM12ON4 * FACTORIAL4,
	.index   = index_eposepe,
	.to_cube = invindex_eposepe,
};

uint64_t index_epud(Cube *cube);
void     invindex_epud(uint64_t ind, Cube *ret);
Indexer
i_epud = {
	.n       = FACTORIAL8,
	.index   = index_epud,
	.to_cube = invindex_epud,
};

/* Composite coordinates *****************************************************/

Coordinate
coord_eofb = {
	.name = "eofb",
	.type = COMP_COORD,
	.i    = {&i_eofb, NULL},
};

Coordinate
coord_coud = {
	.name = "coud",
	.type = COMP_COORD,
	.i    = {&i_coud, NULL},
};

Coordinate
coord_cp = {
	.name = "cp",
	.type = COMP_COORD,
	.i    = {&i_cp, NULL},
};

Coordinate
coord_cpudsep = {
	.name = "cpudsep",
	.type = COMP_COORD,
	.i    = {&i_cpudsep, NULL},
};

Coordinate
coord_epos = {
	.name = "epos",
	.type = COMP_COORD,
	.i    = {&i_epos, NULL},
};

Coordinate
coord_epe = {
	.name = "epe",
	.type = COMP_COORD,
	.i    = {&i_epe, NULL},
};

Coordinate
coord_eposepe = { /* Has to be done by hand, hard compose epos + epe */
	.name = "eposepe",
	.type = COMP_COORD,
	.i    = {&i_eposepe, NULL},
};

Coordinate
coord_epud = {
	.name = "epud",
	.type = COMP_COORD,
	.i    = {&i_epud, NULL},
};

Coordinate
coord_eofbepos = {
	.name = "eofbepos",
	.type = COMP_COORD,
	.i    = {&i_epos, &i_eofb, NULL},
};

Coordinate
coord_coud_cpudsep = {
	.name = "coud_cpudsep",
	.type = COMP_COORD,
	.i    = {&i_coud, &i_cpudsep, NULL},
};

/* Symcoordinates ************************************************************/

Coordinate
coord_eofbepos_sym16 = {
	.name = "eofbepos_sym16",
	.type = SYM_COORD,
	.base = {&coord_eofbepos, NULL},
	.tgrp = &tgrp_udfix,
};

Coordinate
coord_cp_sym16 = {
	.name = "cp_sym16",
	.type = SYM_COORD,
	.base = {&coord_cp, NULL},
	.tgrp = &tgrp_udfix,
};

/* "Symcomp" coordinates *****************************************************/

Coordinate
coord_corners_sym16 = {
	.name = "corners_sym16",
	.type = SYMCOMP_COORD,
	.base = {&coord_cp_sym16, &coord_coud},
};

Coordinate
coord_drud_sym16 = {
	.name = "drud_sym16",
	.type = SYMCOMP_COORD,
	.base = {&coord_eofbepos_sym16, &coord_coud},
};

Coordinate
coord_drudfin_noE_sym16 = {
	.name = "drudfin_noE_sym16",
	.type = SYMCOMP_COORD,
	.base = {&coord_cp_sym16, &coord_epud},
};

Coordinate
coord_nxopt31 = {
	.name = "nxopt31",
	.type = SYMCOMP_COORD,
	.base = {&coord_eofbepos_sym16, &coord_coud_cpudsep},
};

/* All coordinates ***********************************************************/

Coordinate *all_coordinates[] = {
	&coord_eofb,
	&coord_coud,
	&coord_cp,
	&coord_cpudsep,
	&coord_epos,
	&coord_epe,
	&coord_eposepe,
	&coord_epud,
	&coord_eofbepos,
	&coord_coud_cpudsep,
	&coord_eofbepos_sym16,
	&coord_cp_sym16,
	&coord_corners_sym16,
	&coord_drud_sym16,
	&coord_drudfin_noE_sym16,
	&coord_nxopt31,
	NULL
};

#endif

#endif

Generated with cgit - Back to sebastiano.tronto.net