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