aboutsummaryrefslogtreecommitdiff
path: root/src/cubetypes.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2021-12-08 21:50:35 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2021-12-08 21:50:35 +0100
commit849edbb69700a9f7520e159d94333ef5b798685b (patch)
tree8239946c5962c397ab76b6757c61c284a8abca52 /src/cubetypes.h
parent1573b0d3077aade290f03482b1620b2295d2c58c (diff)
downloadnissy-849edbb69700a9f7520e159d94333ef5b798685b.tar.gz
nissy-849edbb69700a9f7520e159d94333ef5b798685b.zip
Just refortmatting and added one type
Diffstat (limited to 'src/cubetypes.h')
-rw-r--r--src/cubetypes.h311
1 files changed, 162 insertions, 149 deletions
diff --git a/src/cubetypes.h b/src/cubetypes.h
index f4e682d..ccc2d34 100644
--- a/src/cubetypes.h
+++ b/src/cubetypes.h
@@ -72,24 +72,25 @@ trans
72 72
73/* Typedefs ******************************************************************/ 73/* Typedefs ******************************************************************/
74 74
75typedef struct alg Alg; 75typedef struct alg Alg;
76typedef struct alglist AlgList; 76typedef struct alglist AlgList;
77typedef struct alglistnode AlgListNode; 77typedef struct alglistnode AlgListNode;
78typedef struct block Block; 78typedef struct block Block;
79typedef struct command Command; 79typedef struct command Command;
80typedef struct commandargs CommandArgs; 80typedef struct commandargs CommandArgs;
81typedef struct coordinate Coordinate; 81typedef struct coordinate Coordinate;
82typedef struct cube Cube; 82typedef struct cube Cube;
83typedef struct cubearray CubeArray; 83typedef struct cubearray CubeArray;
84typedef struct dfsdata DfsData; 84typedef struct dfsdata DfsData;
85typedef struct estimatedata EstimateData; 85typedef struct estimatedata EstimateData;
86typedef struct localinfo LocalInfo; 86typedef struct localinfo LocalInfo;
87typedef struct piecefilter PieceFilter; 87typedef struct piecefilter PieceFilter;
88typedef struct prunedata PruneData; 88typedef struct prunedata PruneData;
89typedef struct solveoptions SolveOptions; 89typedef struct solveoptions SolveOptions;
90typedef struct step Step; 90typedef struct step Step;
91typedef struct symdata SymData; 91typedef struct symdata SymData;
92typedef struct threaddata ThreadData; 92typedef struct threaddatasolve ThreadDataSolve;
93typedef struct threaddatagenpt ThreadDataGenpt;
93 94
94typedef Cube (*AntiIndexer) (uint64_t); 95typedef Cube (*AntiIndexer) (uint64_t);
95typedef bool (*Checker) (Cube); 96typedef bool (*Checker) (Cube);
@@ -108,221 +109,233 @@ typedef int (*TransFinder) (uint64_t, Trans *);
108struct 109struct
109alg 110alg
110{ 111{
111 Move * move; 112 Move * move;
112 bool * inv; 113 bool * inv;
113 int len; 114 int len;
114 int allocated; 115 int allocated;
115}; 116};
116 117
117struct 118struct
118alglist 119alglist
119{ 120{
120 AlgListNode * first; 121 AlgListNode * first;
121 AlgListNode * last; 122 AlgListNode * last;
122 int len; 123 int len;
123}; 124};
124 125
125struct 126struct
126alglistnode 127alglistnode
127{ 128{
128 Alg * alg; 129 Alg * alg;
129 AlgListNode * next; 130 AlgListNode * next;
130}; 131};
131 132
132struct 133struct
133block 134block
134{ 135{
135 bool edge[12]; 136 bool edge[12];
136 bool corner[8]; 137 bool corner[8];
137 bool center[6]; 138 bool center[6];
138}; 139};
139 140
140struct 141struct
141command 142command
142{ 143{
143 char * name; 144 char * name;
144 char * usage; 145 char * usage;
145 char * description; 146 char * description;
146 ArgParser parse_args; 147 ArgParser parse_args;
147 Exec exec; 148 Exec exec;
148}; 149};
149 150
150struct 151struct
151commandargs 152commandargs
152{ 153{
153 bool success; 154 bool success;
154 Alg * scramble; 155 Alg * scramble;
155 SolveOptions * opts; 156 SolveOptions * opts;
156 Step * step; 157 Step * step;
157 Command * command; /* For help */ 158 Command * command; /* For help */
158}; 159};
159 160
160struct 161struct
161coordinate 162coordinate
162{ 163{
163 Indexer index; 164 Indexer index;
164 AntiIndexer cube; 165 AntiIndexer cube;
165 uint64_t max; 166 uint64_t max;
166 TransFinder trans; 167 TransFinder trans;
167}; 168};
168 169
169struct 170struct
170cube 171cube
171{ 172{
172 int epose; 173 int epose;
173 int eposs; 174 int eposs;
174 int eposm; 175 int eposm;
175 int eofb; 176 int eofb;
176 int eorl; 177 int eorl;
177 int eoud; 178 int eoud;
178 int cp; 179 int cp;
179 int coud; 180 int coud;
180 int cofb; 181 int cofb;
181 int corl; 182 int corl;
182 int cpos; 183 int cpos;
183}; 184};
184 185
185struct 186struct
186cubearray 187cubearray
187{ 188{
188 int * ep; 189 int * ep;
189 int * eofb; 190 int * eofb;
190 int * eorl; 191 int * eorl;
191 int * eoud; 192 int * eoud;
192 int * cp; 193 int * cp;
193 int * coud; 194 int * coud;
194 int * corl; 195 int * corl;
195 int * cofb; 196 int * cofb;
196 int * cpos; 197 int * cpos;
197}; 198};
198 199
199struct 200struct
200dfsdata 201dfsdata
201{ 202{
202 int d; 203 int d;
203 int m; 204 int m;
204 int lb; 205 int lb;
205 bool niss; 206 bool niss;
206 Move last1; 207 Move last1;
207 Move last2; 208 Move last2;
208 EstimateData * ed; 209 EstimateData * ed;
209 AlgList * sols; 210 AlgList * sols;
210 pthread_mutex_t * sols_mutex; 211 pthread_mutex_t * sols_mutex;
211 Alg * current_alg; 212 Alg * current_alg;
212 Move * sorted_moves; 213 Move * sorted_moves;
213 int * move_position; 214 int * move_position;
214 uint8_t * visited; 215 uint8_t * visited;
215}; 216};
216 217
217struct 218struct
218estimatedata 219estimatedata
219{ 220{
220 Cube cube; 221 Cube cube;
221 int target; 222 int target;
222 Move lastmove; 223 Move lastmove;
223 uint64_t movebitmask; 224 uint64_t movebitmask;
224 LocalInfo * li; 225 LocalInfo * li;
225}; 226};
226 227
227struct 228struct
228localinfo 229localinfo
229{ 230{
230 int corners; 231 int corners;
231 int normal_ud; 232 int normal_ud;
232 int normal_fb; 233 int normal_fb;
233 int normal_rl; 234 int normal_rl;
234 int inverse_ud; 235 int inverse_ud;
235 int inverse_fb; 236 int inverse_fb;
236 int inverse_rl; 237 int inverse_rl;
237 int prev_ret; 238 int prev_ret;
238}; 239};
239 240
240struct 241struct
241piecefilter 242piecefilter
242{ 243{
243 bool epose; 244 bool epose;
244 bool eposs; 245 bool eposs;
245 bool eposm; 246 bool eposm;
246 bool eofb; 247 bool eofb;
247 bool eorl; 248 bool eorl;
248 bool eoud; 249 bool eoud;
249 bool cp; 250 bool cp;
250 bool coud; 251 bool coud;
251 bool cofb; 252 bool cofb;
252 bool corl; 253 bool corl;
253 bool cpos; 254 bool cpos;
254}; 255};
255 256
256struct 257struct
257prunedata 258prunedata
258{ 259{
259 char * filename; 260 char * filename;
260 uint8_t * ptable; 261 uint8_t * ptable;
261 bool generated; 262 bool generated;
262 uint64_t n; 263 uint64_t n;
263 Coordinate * coord; 264 Coordinate * coord;
264 Moveset moveset; 265 Moveset moveset;
265}; 266};
266 267
267struct 268struct
268solveoptions 269solveoptions
269{ 270{
270 int min_moves; 271 int min_moves;
271 int max_moves; 272 int max_moves;
272 int max_solutions; 273 int max_solutions;
273 int nthreads; 274 int nthreads;
274 bool optimal_only; 275 bool optimal_only;
275 bool can_niss; 276 bool can_niss;
276 bool verbose; 277 bool verbose;
277 bool all; 278 bool all;
278 bool print_number; 279 bool print_number;
279}; 280};
280 281
281struct 282struct
282step 283step
283{ 284{
284 char * shortname; 285 char * shortname;
285 char * name; 286 char * name;
286 Estimator estimate; 287 Estimator estimate;
287 Checker ready; 288 Checker ready;
288 char * ready_msg; 289 char * ready_msg;
289 Validator is_valid; 290 Validator is_valid;
290 Moveset moveset; 291 Moveset moveset;
291 Trans pre_trans; 292 Trans pre_trans;
292 TransDetector detect; 293 TransDetector detect;
293 int ntables; 294 int ntables;
294 PruneData * tables[10]; 295 PruneData * tables[10];
295}; 296};
296 297
297struct 298struct
298symdata 299symdata
299{ 300{
300 char * filename; 301 char * filename;
301 bool generated; 302 bool generated;
302 Coordinate * coord; 303 Coordinate * coord;
303 Coordinate * sym_coord; 304 Coordinate * sym_coord;
304 int ntrans; 305 int ntrans;
305 Trans * trans; 306 Trans * trans;
306 uint64_t * class; 307 uint64_t * class;
307 Cube * rep; 308 Cube * rep;
308 Trans * transtorep; 309 Trans * transtorep;
309}; 310};
310 311
311struct 312struct
312threaddata 313threaddatasolve
313{ 314{
314 int thid; 315 int thid;
315 Cube cube; 316 Cube cube;
316 Step * step; 317 Step * step;
317 int depth; 318 int depth;
318 Move * sorted_moves; 319 Move * sorted_moves;
319 int * move_position; 320 int * move_position;
320 SolveOptions * opts; 321 SolveOptions * opts;
321 AlgList * start; 322 AlgList * start;
322 AlgListNode ** node; 323 AlgListNode ** node;
323 AlgList * sols; 324 AlgList * sols;
324 pthread_mutex_t * start_mutex; 325 pthread_mutex_t * start_mutex;
325 pthread_mutex_t * sols_mutex; 326 pthread_mutex_t * sols_mutex;
327};
328
329struct
330threaddatagenpt
331{
332 int thid;
333 PruneData * pd;
334 int d;
335 uint64_t rangemin;
336 uint64_t rangemax;
337 int nchunks;
338 pthread_mutex_t ** mutex;
326}; 339};
327 340
328#endif 341#endif

Generated with cgit - Back to sebastiano.tronto.net