aboutsummaryrefslogtreecommitdiff
path: root/src/cubetypes.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/cubetypes.h231
1 files changed, 126 insertions, 105 deletions
diff --git a/src/cubetypes.h b/src/cubetypes.h
index 334662c..7eb803e 100644
--- a/src/cubetypes.h
+++ b/src/cubetypes.h
@@ -3,6 +3,7 @@
3 3
4#include <stdbool.h> 4#include <stdbool.h>
5#include <inttypes.h> 5#include <inttypes.h>
6#include <pthread.h>
6 7
7#define NMOVES 55 /* Actually 55, but one is NULLMOVE */ 8#define NMOVES 55 /* Actually 55, but one is NULLMOVE */
8#define NTRANS 48 9#define NTRANS 48
@@ -87,6 +88,7 @@ typedef struct prunedata PruneData;
87typedef struct solveoptions SolveOptions; 88typedef struct solveoptions SolveOptions;
88typedef struct step Step; 89typedef struct step Step;
89typedef struct symdata SymData; 90typedef struct symdata SymData;
91typedef struct threaddata ThreadData;
90 92
91typedef Cube (*AntiIndexer) (uint64_t); 93typedef Cube (*AntiIndexer) (uint64_t);
92typedef bool (*Checker) (Cube); 94typedef bool (*Checker) (Cube);
@@ -104,186 +106,205 @@ typedef Trans (*TransDetector) (Cube);
104struct 106struct
105alg 107alg
106{ 108{
107 Move * move; 109 Move * move;
108 bool * inv; 110 bool * inv;
109 int len; 111 int len;
110 int allocated; 112 int allocated;
111}; 113};
112 114
113struct 115struct
114alglist 116alglist
115{ 117{
116 AlgListNode * first; 118 AlgListNode * first;
117 AlgListNode * last; 119 AlgListNode * last;
118 int len; 120 int len;
119}; 121};
120 122
121struct 123struct
122alglistnode 124alglistnode
123{ 125{
124 Alg * alg; 126 Alg * alg;
125 AlgListNode * next; 127 AlgListNode * next;
126}; 128};
127 129
128struct 130struct
129block 131block
130{ 132{
131 bool edge[12]; 133 bool edge[12];
132 bool corner[8]; 134 bool corner[8];
133 bool center[6]; 135 bool center[6];
134}; 136};
135 137
136struct 138struct
137command 139command
138{ 140{
139 char * name; 141 char * name;
140 char * usage; 142 char * usage;
141 char * description; 143 char * description;
142 ArgParser parse_args; 144 ArgParser parse_args;
143 Exec exec; 145 Exec exec;
144}; 146};
145 147
146struct 148struct
147commandargs 149commandargs
148{ 150{
149 bool success; 151 bool success;
150 Alg * scramble; 152 Alg * scramble;
151 SolveOptions * opts; 153 SolveOptions * opts;
152 Step * step; 154 Step * step;
153 Command * command; /* For help */ 155 Command * command; /* For help */
154}; 156};
155 157
156struct 158struct
157coordinate 159coordinate
158{ 160{
159 Indexer index; 161 Indexer index;
160 AntiIndexer cube; 162 AntiIndexer cube;
161 uint64_t max; 163 uint64_t max;
162 int ntrans; 164 int ntrans;
163 Trans * trans; 165 Trans * trans;
164}; 166};
165 167
166struct 168struct
167cube 169cube
168{ 170{
169 int epose; 171 int epose;
170 int eposs; 172 int eposs;
171 int eposm; 173 int eposm;
172 int eofb; 174 int eofb;
173 int eorl; 175 int eorl;
174 int eoud; 176 int eoud;
175 int cp; 177 int cp;
176 int coud; 178 int coud;
177 int cofb; 179 int cofb;
178 int corl; 180 int corl;
179 int cpos; 181 int cpos;
180}; 182};
181 183
182struct 184struct
183cubearray 185cubearray
184{ 186{
185 int * ep; 187 int * ep;
186 int * eofb; 188 int * eofb;
187 int * eorl; 189 int * eorl;
188 int * eoud; 190 int * eoud;
189 int * cp; 191 int * cp;
190 int * coud; 192 int * coud;
191 int * corl; 193 int * corl;
192 int * cofb; 194 int * cofb;
193 int * cpos; 195 int * cpos;
194}; 196};
195 197
196struct 198struct
197cubetarget 199cubetarget
198{ 200{
199 Cube cube; 201 Cube cube;
200 int target; 202 int target;
201}; 203};
202 204
203struct 205struct
204dfsdata 206dfsdata
205{ 207{
206 int d; 208 int d;
207 int m; 209 int m;
208 int lb; 210 int lb;
209 bool niss; 211 bool niss;
210 Move last1; 212 Move last1;
211 Move last2; 213 Move last2;
212 AlgList * sols; 214 AlgList * sols;
213 Alg * current_alg; 215 pthread_mutex_t * sols_mutex;
214 Move sorted_moves[NMOVES]; 216 Alg * current_alg;
215 int move_position[NMOVES]; 217 Move * sorted_moves;
216 uint8_t * visited; 218 int * move_position;
219 uint8_t * visited;
217}; 220};
218 221
219struct 222struct
220piecefilter 223piecefilter
221{ 224{
222 bool epose; 225 bool epose;
223 bool eposs; 226 bool eposs;
224 bool eposm; 227 bool eposm;
225 bool eofb; 228 bool eofb;
226 bool eorl; 229 bool eorl;
227 bool eoud; 230 bool eoud;
228 bool cp; 231 bool cp;
229 bool coud; 232 bool coud;
230 bool cofb; 233 bool cofb;
231 bool corl; 234 bool corl;
232 bool cpos; 235 bool cpos;
233}; 236};
234 237
235struct 238struct
236prunedata 239prunedata
237{ 240{
238 char * filename; 241 char * filename;
239 uint8_t * ptable; 242 uint8_t * ptable;
240 bool generated; 243 bool generated;
241 uint64_t n; 244 uint64_t n;
242 Coordinate * coord; 245 Coordinate * coord;
243 Moveset moveset; 246 Moveset moveset;
244}; 247};
245 248
246struct 249struct
247solveoptions 250solveoptions
248{ 251{
249 int min_moves; 252 int min_moves;
250 int max_moves; 253 int max_moves;
251 int max_solutions; 254 int max_solutions;
252 bool optimal_only; 255 int nthreads;
253 bool can_niss; 256 bool optimal_only;
254 bool verbose; 257 bool can_niss;
255 bool all; 258 bool verbose;
256 bool print_number; 259 bool all;
260 bool print_number;
257}; 261};
258 262
259struct 263struct
260step 264step
261{ 265{
262 char * shortname; 266 char * shortname;
263 char * name; 267 char * name;
264 Estimator estimate; 268 Estimator estimate;
265 Checker ready; 269 Checker ready;
266 char * ready_msg; 270 char * ready_msg;
267 Validator is_valid; 271 Validator is_valid;
268 Moveset moveset; 272 Moveset moveset;
269 Trans pre_trans; 273 Trans pre_trans;
270 TransDetector detect; 274 TransDetector detect;
271 int ntables; 275 int ntables;
272 PruneData * tables[10]; 276 PruneData * tables[10];
273}; 277};
274 278
275struct 279struct
276symdata 280symdata
277{ 281{
278 char * filename; 282 char * filename;
279 bool generated; 283 bool generated;
280 Coordinate * coord; 284 Coordinate * coord;
281 Coordinate * sym_coord; 285 Coordinate * sym_coord;
282 int ntrans; 286 int ntrans;
283 Trans * trans; 287 Trans * trans;
284 uint64_t * class; 288 uint64_t * class;
285 Cube * rep; 289 Cube * rep;
286 Trans * transtorep; 290 Trans * transtorep;
291};
292
293struct
294threaddata
295{
296 int thid;
297 Cube cube;
298 Step * step;
299 int depth;
300 Move * sorted_moves;
301 int * move_position;
302 SolveOptions * opts;
303 AlgList * start;
304 AlgListNode ** node;
305 AlgList * sols;
306 pthread_mutex_t * start_mutex;
307 pthread_mutex_t * sols_mutex;
287}; 308};
288 309
289#endif 310#endif

Generated with cgit - Back to sebastiano.tronto.net