coord.h (5156B)
1 #ifndef COORD_H 2 #define COORD_H 3 4 #include "trans.h" 5 6 void gen_coord(Coordinate *coord); 7 uint64_t index_coord(Coordinate *coord, Cube *cube, 8 Trans *offtrans); 9 uint64_t indexers_getind(Indexer **is, Cube *c); 10 void indexers_makecube(Indexer **is, uint64_t ind, Cube *c); 11 uint64_t move_coord(Coordinate *coord, Move m, 12 uint64_t ind, Trans *offtrans); 13 uint64_t trans_coord(Coordinate *coord, Trans t, uint64_t ind); 14 15 /* Base coordinates and their index functions ********************************/ 16 17 #ifndef COORD_C 18 19 extern Coordinate coord_eofb; 20 extern Coordinate coord_coud; 21 extern Coordinate coord_cp; 22 extern Coordinate coord_cpudsep; 23 extern Coordinate coord_epos; 24 extern Coordinate coord_epe; 25 extern Coordinate coord_eposepe; 26 extern Coordinate coord_epud; 27 extern Coordinate coord_eofbepos; 28 extern Coordinate coord_coud_cpudsep; 29 extern Coordinate coord_eofbepos_sym16; 30 extern Coordinate coord_nxopt31; 31 32 extern Coordinate *all_coordinates[]; 33 34 #else 35 36 /* Indexers ******************************************************************/ 37 38 uint64_t index_eofb(Cube *cube); 39 void invindex_eofb(uint64_t ind, Cube *ret); 40 Indexer 41 i_eofb = { 42 .n = POW2TO11, 43 .index = index_eofb, 44 .to_cube = invindex_eofb, 45 }; 46 47 uint64_t index_coud(Cube *cube); 48 void invindex_coud(uint64_t ind, Cube *ret); 49 Indexer 50 i_coud = { 51 .n = POW3TO7, 52 .index = index_coud, 53 .to_cube = invindex_coud, 54 }; 55 56 uint64_t index_cp(Cube *cube); 57 void invindex_cp(uint64_t ind, Cube *ret); 58 Indexer 59 i_cp = { 60 .n = FACTORIAL8, 61 .index = index_cp, 62 .to_cube = invindex_cp, 63 }; 64 65 uint64_t index_cpudsep(Cube *cube); 66 void invindex_cpudsep(uint64_t ind, Cube *ret); 67 Indexer 68 i_cpudsep = { 69 .n = BINOM8ON4, 70 .index = index_cpudsep, 71 .to_cube = invindex_cpudsep, 72 }; 73 74 uint64_t index_epos(Cube *cube); 75 void invindex_epos(uint64_t ind, Cube *ret); 76 Indexer 77 i_epos = { 78 .n = BINOM12ON4, 79 .index = index_epos, 80 .to_cube = invindex_epos, 81 }; 82 83 uint64_t index_epe(Cube *cube); 84 void invindex_epe(uint64_t ind, Cube *ret); 85 Indexer 86 i_epe = { 87 .n = FACTORIAL4, 88 .index = index_epe, 89 .to_cube = invindex_epe, 90 }; 91 92 uint64_t index_eposepe(Cube *cube); 93 void invindex_eposepe(uint64_t ind, Cube *ret); 94 Indexer 95 i_eposepe = { 96 .n = BINOM12ON4 * FACTORIAL4, 97 .index = index_eposepe, 98 .to_cube = invindex_eposepe, 99 }; 100 101 uint64_t index_epud(Cube *cube); 102 void invindex_epud(uint64_t ind, Cube *ret); 103 Indexer 104 i_epud = { 105 .n = FACTORIAL8, 106 .index = index_epud, 107 .to_cube = invindex_epud, 108 }; 109 110 /* Composite coordinates *****************************************************/ 111 112 Coordinate 113 coord_eofb = { 114 .name = "eofb", 115 .type = COMP_COORD, 116 .i = {&i_eofb, NULL}, 117 }; 118 119 Coordinate 120 coord_coud = { 121 .name = "coud", 122 .type = COMP_COORD, 123 .i = {&i_coud, NULL}, 124 }; 125 126 Coordinate 127 coord_cp = { 128 .name = "cp", 129 .type = COMP_COORD, 130 .i = {&i_cp, NULL}, 131 }; 132 133 Coordinate 134 coord_cpudsep = { 135 .name = "cpudsep", 136 .type = COMP_COORD, 137 .i = {&i_cpudsep, NULL}, 138 }; 139 140 Coordinate 141 coord_epos = { 142 .name = "epos", 143 .type = COMP_COORD, 144 .i = {&i_epos, NULL}, 145 }; 146 147 Coordinate 148 coord_epe = { 149 .name = "epe", 150 .type = COMP_COORD, 151 .i = {&i_epe, NULL}, 152 }; 153 154 Coordinate 155 coord_eposepe = { /* Has to be done by hand, hard compose epos + epe */ 156 .name = "eposepe", 157 .type = COMP_COORD, 158 .i = {&i_eposepe, NULL}, 159 }; 160 161 Coordinate 162 coord_epud = { 163 .name = "epud", 164 .type = COMP_COORD, 165 .i = {&i_epud, NULL}, 166 }; 167 168 Coordinate 169 coord_eofbepos = { 170 .name = "eofbepos", 171 .type = COMP_COORD, 172 .i = {&i_epos, &i_eofb, NULL}, 173 }; 174 175 Coordinate 176 coord_coud_cpudsep = { 177 .name = "coud_cpudsep", 178 .type = COMP_COORD, 179 .i = {&i_coud, &i_cpudsep, NULL}, 180 }; 181 182 /* Symcoordinates ************************************************************/ 183 184 Coordinate 185 coord_eofbepos_sym16 = { 186 .name = "eofbepos_sym16", 187 .type = SYM_COORD, 188 .base = {&coord_eofbepos, NULL}, 189 .tgrp = &tgrp_udfix, 190 }; 191 192 Coordinate 193 coord_cp_sym16 = { 194 .name = "cp_sym16", 195 .type = SYM_COORD, 196 .base = {&coord_cp, NULL}, 197 .tgrp = &tgrp_udfix, 198 }; 199 200 /* "Symcomp" coordinates *****************************************************/ 201 202 Coordinate 203 coord_corners_sym16 = { 204 .name = "corners_sym16", 205 .type = SYMCOMP_COORD, 206 .base = {&coord_cp_sym16, &coord_coud}, 207 }; 208 209 Coordinate 210 coord_drud_sym16 = { 211 .name = "drud_sym16", 212 .type = SYMCOMP_COORD, 213 .base = {&coord_eofbepos_sym16, &coord_coud}, 214 }; 215 216 Coordinate 217 coord_drudfin_noE_sym16 = { 218 .name = "drudfin_noE_sym16", 219 .type = SYMCOMP_COORD, 220 .base = {&coord_cp_sym16, &coord_epud}, 221 }; 222 223 Coordinate 224 coord_nxopt31 = { 225 .name = "nxopt31", 226 .type = SYMCOMP_COORD, 227 .base = {&coord_eofbepos_sym16, &coord_coud_cpudsep}, 228 }; 229 230 /* All coordinates ***********************************************************/ 231 232 Coordinate *all_coordinates[] = { 233 &coord_eofb, 234 &coord_coud, 235 &coord_cp, 236 &coord_cpudsep, 237 &coord_epos, 238 &coord_epe, 239 &coord_eposepe, 240 &coord_epud, 241 &coord_eofbepos, 242 &coord_coud_cpudsep, 243 &coord_eofbepos_sym16, 244 &coord_cp_sym16, 245 &coord_corners_sym16, 246 &coord_drud_sym16, 247 &coord_drudfin_noE_sym16, 248 &coord_nxopt31, 249 NULL 250 }; 251 252 #endif 253 254 #endif 255