diff options
Diffstat (limited to 'old/2021-11-10-beforeremovingchecker/cubetypes.h')
| -rw-r--r-- | old/2021-11-10-beforeremovingchecker/cubetypes.h | 298 |
1 files changed, 0 insertions, 298 deletions
diff --git a/old/2021-11-10-beforeremovingchecker/cubetypes.h b/old/2021-11-10-beforeremovingchecker/cubetypes.h deleted file mode 100644 index 38a6f8d..0000000 --- a/old/2021-11-10-beforeremovingchecker/cubetypes.h +++ /dev/null | |||
| @@ -1,298 +0,0 @@ | |||
| 1 | #ifndef CUBETYPES_H | ||
| 2 | #define CUBETYPES_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | #include <stdint.h> | ||
| 6 | |||
| 7 | #define NMOVES 55 /* Actually 55, but one is NULLMOVE */ | ||
| 8 | #define NTRANS 48 | ||
| 9 | #define NROTATIONS 24 | ||
| 10 | |||
| 11 | |||
| 12 | /* Typedefs ******************************************************************/ | ||
| 13 | |||
| 14 | typedef enum center Center; | ||
| 15 | typedef enum corner Corner; | ||
| 16 | typedef enum edge Edge; | ||
| 17 | typedef enum move Move; | ||
| 18 | typedef enum trans Trans; | ||
| 19 | |||
| 20 | typedef struct alg Alg; | ||
| 21 | typedef struct alglist AlgList; | ||
| 22 | typedef struct alglistnode AlgListNode; | ||
| 23 | typedef struct block Block; | ||
| 24 | typedef struct command Command; | ||
| 25 | typedef struct commandargs CommandArgs; | ||
| 26 | typedef struct coordinate Coordinate; | ||
| 27 | typedef struct cube Cube; | ||
| 28 | typedef struct cubearray CubeArray; | ||
| 29 | typedef struct cubetarget CubeTarget; | ||
| 30 | typedef struct dfsdata DfsData; | ||
| 31 | typedef struct piecefilter PieceFilter; | ||
| 32 | typedef struct prunedata PruneData; | ||
| 33 | typedef struct solveoptions SolveOptions; | ||
| 34 | typedef struct step Step; | ||
| 35 | typedef struct symdata SymData; | ||
| 36 | |||
| 37 | typedef Cube (*AntiIndexer) (uint64_t); | ||
| 38 | typedef bool (*Checker) (Cube); | ||
| 39 | typedef int (*Estimator) (CubeTarget); | ||
| 40 | typedef bool (*Validator) (Alg *); | ||
| 41 | typedef void (*Exec) (CommandArgs *); | ||
| 42 | typedef uint64_t (*Indexer) (Cube); | ||
| 43 | typedef bool (*Moveset) (Move); | ||
| 44 | typedef CommandArgs * (*ArgParser) (int, char **); | ||
| 45 | typedef Trans (*TransDetector) (Cube); | ||
| 46 | |||
| 47 | |||
| 48 | /* Enums *********************************************************************/ | ||
| 49 | |||
| 50 | enum | ||
| 51 | center | ||
| 52 | { | ||
| 53 | U_center, D_center, | ||
| 54 | R_center, L_center, | ||
| 55 | F_center, B_center | ||
| 56 | }; | ||
| 57 | |||
| 58 | enum | ||
| 59 | corner | ||
| 60 | { | ||
| 61 | UFR, UFL, UBL, UBR, | ||
| 62 | DFR, DFL, DBL, DBR | ||
| 63 | }; | ||
| 64 | |||
| 65 | enum | ||
| 66 | edge | ||
| 67 | { | ||
| 68 | UF, UL, UB, UR, | ||
| 69 | DF, DL, DB, DR, | ||
| 70 | FR, FL, BL, BR | ||
| 71 | }; | ||
| 72 | |||
| 73 | enum | ||
| 74 | move | ||
| 75 | { | ||
| 76 | NULLMOVE, | ||
| 77 | U, U2, U3, D, D2, D3, | ||
| 78 | R, R2, R3, L, L2, L3, | ||
| 79 | F, F2, F3, B, B2, B3, | ||
| 80 | Uw, Uw2, Uw3, Dw, Dw2, Dw3, | ||
| 81 | Rw, Rw2, Rw3, Lw, Lw2, Lw3, | ||
| 82 | Fw, Fw2, Fw3, Bw, Bw2, Bw3, | ||
| 83 | M, M2, M3, | ||
| 84 | S, S2, S3, | ||
| 85 | E, E2, E3, | ||
| 86 | x, x2, x3, | ||
| 87 | y, y2, y3, | ||
| 88 | z, z2, z3, | ||
| 89 | }; | ||
| 90 | |||
| 91 | enum | ||
| 92 | trans | ||
| 93 | { | ||
| 94 | uf, ur, ub, ul, | ||
| 95 | df, dr, db, dl, | ||
| 96 | rf, rd, rb, ru, | ||
| 97 | lf, ld, lb, lu, | ||
| 98 | fu, fr, fd, fl, | ||
| 99 | bu, br, bd, bl, | ||
| 100 | uf_mirror, ur_mirror, ub_mirror, ul_mirror, | ||
| 101 | df_mirror, dr_mirror, db_mirror, dl_mirror, | ||
| 102 | rf_mirror, rd_mirror, rb_mirror, ru_mirror, | ||
| 103 | lf_mirror, ld_mirror, lb_mirror, lu_mirror, | ||
| 104 | fu_mirror, fr_mirror, fd_mirror, fl_mirror, | ||
| 105 | bu_mirror, br_mirror, bd_mirror, bl_mirror, | ||
| 106 | }; | ||
| 107 | |||
| 108 | |||
| 109 | /* Structs *******************************************************************/ | ||
| 110 | |||
| 111 | struct | ||
| 112 | alg | ||
| 113 | { | ||
| 114 | Move * move; | ||
| 115 | bool * inv; | ||
| 116 | int len; | ||
| 117 | int allocated; | ||
| 118 | }; | ||
| 119 | |||
| 120 | struct | ||
| 121 | alglist | ||
| 122 | { | ||
| 123 | AlgListNode * first; | ||
| 124 | AlgListNode * last; | ||
| 125 | int len; | ||
| 126 | }; | ||
| 127 | |||
| 128 | struct | ||
| 129 | alglistnode | ||
| 130 | { | ||
| 131 | Alg * alg; | ||
| 132 | AlgListNode * next; | ||
| 133 | }; | ||
| 134 | |||
| 135 | struct | ||
| 136 | block | ||
| 137 | { | ||
| 138 | bool edge[12]; | ||
| 139 | bool corner[8]; | ||
| 140 | bool center[6]; | ||
| 141 | }; | ||
| 142 | |||
| 143 | struct | ||
| 144 | command | ||
| 145 | { | ||
| 146 | /* TODO: more stuff to add? maybe complete help? */ | ||
| 147 | /* Maybe add list of options */ | ||
| 148 | char * name; | ||
| 149 | char * usage; | ||
| 150 | char * description; | ||
| 151 | ArgParser parse_args; | ||
| 152 | Exec exec; | ||
| 153 | }; | ||
| 154 | |||
| 155 | struct | ||
| 156 | commandargs | ||
| 157 | { | ||
| 158 | bool success; | ||
| 159 | Alg * scramble; | ||
| 160 | SolveOptions * opts; | ||
| 161 | Step * step; | ||
| 162 | Command * command; /* For help */ | ||
| 163 | }; | ||
| 164 | |||
| 165 | struct | ||
| 166 | coordinate | ||
| 167 | { | ||
| 168 | Indexer index; | ||
| 169 | AntiIndexer cube; | ||
| 170 | Checker check; | ||
| 171 | uint64_t max; | ||
| 172 | int ntrans; | ||
| 173 | Trans * trans; | ||
| 174 | }; | ||
| 175 | |||
| 176 | struct | ||
| 177 | cube | ||
| 178 | { | ||
| 179 | int epose; | ||
| 180 | int eposs; | ||
| 181 | int eposm; | ||
| 182 | int eofb; | ||
| 183 | int eorl; | ||
| 184 | int eoud; | ||
| 185 | int cp; | ||
| 186 | int coud; | ||
| 187 | int cofb; | ||
| 188 | int corl; | ||
| 189 | int cpos; | ||
| 190 | }; | ||
| 191 | |||
| 192 | struct | ||
| 193 | cubearray | ||
| 194 | { | ||
| 195 | int * ep; | ||
| 196 | int * eofb; | ||
| 197 | int * eorl; | ||
| 198 | int * eoud; | ||
| 199 | int * cp; | ||
| 200 | int * coud; | ||
| 201 | int * corl; | ||
| 202 | int * cofb; | ||
| 203 | int * cpos; | ||
| 204 | }; | ||
| 205 | |||
| 206 | struct | ||
| 207 | cubetarget | ||
| 208 | { | ||
| 209 | Cube cube; | ||
| 210 | int target; | ||
| 211 | }; | ||
| 212 | |||
| 213 | struct | ||
| 214 | dfsdata | ||
| 215 | { | ||
| 216 | int d; | ||
| 217 | int m; | ||
| 218 | int lb; | ||
| 219 | bool niss; | ||
| 220 | Move last1; | ||
| 221 | Move last2; | ||
| 222 | AlgList * sols; | ||
| 223 | Alg * current_alg; | ||
| 224 | Move sorted_moves[NMOVES]; | ||
| 225 | int move_position[NMOVES]; | ||
| 226 | }; | ||
| 227 | |||
| 228 | struct | ||
| 229 | piecefilter | ||
| 230 | { | ||
| 231 | bool epose; | ||
| 232 | bool eposs; | ||
| 233 | bool eposm; | ||
| 234 | bool eofb; | ||
| 235 | bool eorl; | ||
| 236 | bool eoud; | ||
| 237 | bool cp; | ||
| 238 | bool coud; | ||
| 239 | bool cofb; | ||
| 240 | bool corl; | ||
| 241 | bool cpos; | ||
| 242 | }; | ||
| 243 | |||
| 244 | struct | ||
| 245 | prunedata | ||
| 246 | { | ||
| 247 | char * filename; | ||
| 248 | uint8_t * ptable; | ||
| 249 | bool generated; | ||
| 250 | uint64_t n; | ||
| 251 | Coordinate * coord; | ||
| 252 | Moveset moveset; | ||
| 253 | }; | ||
| 254 | |||
| 255 | struct | ||
| 256 | solveoptions | ||
| 257 | { | ||
| 258 | /* TODO: add option to list *all* solutions satisfying other | ||
| 259 | constraints (min/max moves and optimality) */ | ||
| 260 | int min_moves; | ||
| 261 | int max_moves; | ||
| 262 | int max_solutions; | ||
| 263 | bool optimal_only; | ||
| 264 | bool can_niss; | ||
| 265 | bool feedback; /* TODO: rename with "verbose" */ | ||
| 266 | bool all; | ||
| 267 | bool print_number; | ||
| 268 | }; | ||
| 269 | |||
| 270 | struct | ||
| 271 | step | ||
| 272 | { | ||
| 273 | char * shortname; | ||
| 274 | char * name; | ||
| 275 | Estimator estimate; | ||
| 276 | Checker ready; | ||
| 277 | char * ready_msg; | ||
| 278 | Validator is_valid; | ||
| 279 | Moveset moveset; | ||
| 280 | Trans pre_trans; | ||
| 281 | TransDetector detect; | ||
| 282 | }; | ||
| 283 | |||
| 284 | struct | ||
| 285 | symdata | ||
| 286 | { | ||
| 287 | char * filename; | ||
| 288 | bool generated; | ||
| 289 | Coordinate * coord; | ||
| 290 | Coordinate * sym_coord; | ||
| 291 | int ntrans; | ||
| 292 | Trans * trans; | ||
| 293 | uint64_t * class; | ||
| 294 | Cube * rep; | ||
| 295 | Trans * transtorep; | ||
| 296 | }; | ||
| 297 | |||
| 298 | #endif | ||
