diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/cube.c | 126 | ||||
| -rw-r--r-- | src/cube.h | 12 | ||||
| -rw-r--r-- | src/fst.c | 75 | ||||
| -rw-r--r-- | src/fst.h | 1 | ||||
| -rw-r--r-- | src/moves.c | 18 | ||||
| -rw-r--r-- | src/moves.h | 3 |
6 files changed, 189 insertions, 46 deletions
| @@ -5,27 +5,61 @@ | |||
| 5 | static int where_is_piece(int piece, int *arr, int n); | 5 | static int where_is_piece(int piece, int *arr, int n); |
| 6 | 6 | ||
| 7 | void | 7 | void |
| 8 | compose(Cube *c2, Cube *c1) | 8 | compose_centers(Cube *c2, Cube *c1) |
| 9 | { | 9 | { |
| 10 | apply_permutation(c2->ep, c1->ep, 12); | 10 | apply_permutation(c2->xp, c1->xp, 6); |
| 11 | apply_permutation(c2->ep, c1->eo, 12); | 11 | } |
| 12 | sum_arrays_mod(c2->eo, c1->eo, 12, 2); | ||
| 13 | 12 | ||
| 13 | void | ||
| 14 | compose_corners(Cube *c2, Cube *c1) | ||
| 15 | { | ||
| 14 | apply_permutation(c2->cp, c1->cp, 8); | 16 | apply_permutation(c2->cp, c1->cp, 8); |
| 15 | apply_permutation(c2->cp, c1->co, 8); | 17 | apply_permutation(c2->cp, c1->co, 8); |
| 16 | sum_arrays_mod(c2->co, c1->co, 8, 3); | 18 | sum_arrays_mod(c2->co, c1->co, 8, 3); |
| 19 | } | ||
| 17 | 20 | ||
| 18 | apply_permutation(c2->xp, c1->xp, 6); | 21 | void |
| 22 | compose_edges(Cube *c2, Cube *c1) | ||
| 23 | { | ||
| 24 | apply_permutation(c2->ep, c1->ep, 12); | ||
| 25 | apply_permutation(c2->ep, c1->eo, 12); | ||
| 26 | sum_arrays_mod(c2->eo, c1->eo, 12, 2); | ||
| 19 | } | 27 | } |
| 20 | 28 | ||
| 21 | void | 29 | void |
| 22 | copy_cube(Cube *src, Cube *dst) | 30 | compose(Cube *c2, Cube *c1) |
| 31 | { | ||
| 32 | compose_centers(c2, c1); | ||
| 33 | compose_corners(c2, c1); | ||
| 34 | compose_edges(c2, c1); | ||
| 35 | } | ||
| 36 | |||
| 37 | void | ||
| 38 | copy_cube_centers(Cube *src, Cube *dst) | ||
| 39 | { | ||
| 40 | memcpy(dst->xp, src->xp, 6 * sizeof(int)); | ||
| 41 | } | ||
| 42 | |||
| 43 | void | ||
| 44 | copy_cube_corners(Cube *src, Cube *dst) | ||
| 23 | { | 45 | { |
| 24 | memcpy(dst->ep, src->ep, 12 * sizeof(int)); | ||
| 25 | memcpy(dst->eo, src->eo, 12 * sizeof(int)); | ||
| 26 | memcpy(dst->cp, src->cp, 8 * sizeof(int)); | 46 | memcpy(dst->cp, src->cp, 8 * sizeof(int)); |
| 27 | memcpy(dst->co, src->co, 8 * sizeof(int)); | 47 | memcpy(dst->co, src->co, 8 * sizeof(int)); |
| 28 | memcpy(dst->xp, src->xp, 6 * sizeof(int)); | 48 | } |
| 49 | |||
| 50 | void | ||
| 51 | copy_cube_edges(Cube *src, Cube *dst) | ||
| 52 | { | ||
| 53 | memcpy(dst->ep, src->ep, 12 * sizeof(int)); | ||
| 54 | memcpy(dst->eo, src->eo, 12 * sizeof(int)); | ||
| 55 | } | ||
| 56 | |||
| 57 | void | ||
| 58 | copy_cube(Cube *src, Cube *dst) | ||
| 59 | { | ||
| 60 | copy_cube_centers(src, dst); | ||
| 61 | copy_cube_corners(src, dst); | ||
| 62 | copy_cube_edges(src, dst); | ||
| 29 | } | 63 | } |
| 30 | 64 | ||
| 31 | bool | 65 | bool |
| @@ -49,25 +83,51 @@ equal(Cube *c1, Cube *c2) | |||
| 49 | } | 83 | } |
| 50 | 84 | ||
| 51 | void | 85 | void |
| 52 | invert_cube(Cube *cube) | 86 | invert_cube_centers(Cube *cube) |
| 53 | { | 87 | { |
| 54 | Cube aux; | ||
| 55 | int i; | 88 | int i; |
| 89 | Cube aux; | ||
| 56 | 90 | ||
| 57 | copy_cube(cube, &aux); | 91 | copy_cube_centers(cube, &aux); |
| 58 | 92 | ||
| 59 | for (i = 0; i < 12; i++) { | 93 | for (i = 0; i < 6; i++) |
| 60 | cube->ep[aux.ep[i]] = i; | 94 | cube->xp[aux.xp[i]] = i; |
| 61 | cube->eo[aux.ep[i]] = aux.eo[i]; | 95 | } |
| 62 | } | 96 | |
| 97 | void | ||
| 98 | invert_cube_corners(Cube *cube) | ||
| 99 | { | ||
| 100 | int i; | ||
| 101 | Cube aux; | ||
| 102 | |||
| 103 | copy_cube_corners(cube, &aux); | ||
| 63 | 104 | ||
| 64 | for (i = 0; i < 8; i++) { | 105 | for (i = 0; i < 8; i++) { |
| 65 | cube->cp[aux.cp[i]] = i; | 106 | cube->cp[aux.cp[i]] = i; |
| 66 | cube->co[aux.cp[i]] = (3 - aux.co[i]) % 3; | 107 | cube->co[aux.cp[i]] = (3 - aux.co[i]) % 3; |
| 67 | } | 108 | } |
| 109 | } | ||
| 68 | 110 | ||
| 69 | for (i = 0; i < 6; i++) | 111 | void |
| 70 | cube->xp[aux.xp[i]] = i; | 112 | invert_cube_edges(Cube *cube) |
| 113 | { | ||
| 114 | int i; | ||
| 115 | Cube aux; | ||
| 116 | |||
| 117 | copy_cube_edges(cube, &aux); | ||
| 118 | |||
| 119 | for (i = 0; i < 12; i++) { | ||
| 120 | cube->ep[aux.ep[i]] = i; | ||
| 121 | cube->eo[aux.ep[i]] = aux.eo[i]; | ||
| 122 | } | ||
| 123 | } | ||
| 124 | |||
| 125 | void | ||
| 126 | invert_cube(Cube *cube) | ||
| 127 | { | ||
| 128 | invert_cube_centers(cube); | ||
| 129 | invert_cube_corners(cube); | ||
| 130 | invert_cube_edges(cube); | ||
| 71 | } | 131 | } |
| 72 | 132 | ||
| 73 | bool | 133 | bool |
| @@ -105,15 +165,37 @@ is_solved(Cube *cube) | |||
| 105 | } | 165 | } |
| 106 | 166 | ||
| 107 | void | 167 | void |
| 108 | make_solved(Cube *cube) | 168 | make_solved_centers(Cube *cube) |
| 169 | { | ||
| 170 | static int sorted[6] = {0, 1, 2, 3, 4, 5}; | ||
| 171 | |||
| 172 | memcpy(cube->xp, sorted, 6 * sizeof(int)); | ||
| 173 | } | ||
| 174 | |||
| 175 | void | ||
| 176 | make_solved_corners(Cube *cube) | ||
| 177 | { | ||
| 178 | static int sorted[8] = {0, 1, 2, 3, 4, 5, 6, 7}; | ||
| 179 | |||
| 180 | memcpy(cube->cp, sorted, 8 * sizeof(int)); | ||
| 181 | memset(cube->co, 0, 8 * sizeof(int)); | ||
| 182 | } | ||
| 183 | |||
| 184 | void | ||
| 185 | make_solved_edges(Cube *cube) | ||
| 109 | { | 186 | { |
| 110 | static int sorted[12] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; | 187 | static int sorted[12] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; |
| 111 | 188 | ||
| 112 | memcpy(cube->ep, sorted, 12 * sizeof(int)); | 189 | memcpy(cube->ep, sorted, 12 * sizeof(int)); |
| 113 | memset(cube->eo, 0, 12 * sizeof(int)); | 190 | memset(cube->eo, 0, 12 * sizeof(int)); |
| 114 | memcpy(cube->cp, sorted, 8 * sizeof(int)); | 191 | } |
| 115 | memset(cube->co, 0, 8 * sizeof(int)); | 192 | |
| 116 | memcpy(cube->xp, sorted, 6 * sizeof(int)); | 193 | void |
| 194 | make_solved(Cube *cube) | ||
| 195 | { | ||
| 196 | make_solved_centers(cube); | ||
| 197 | make_solved_corners(cube); | ||
| 198 | make_solved_edges(cube); | ||
| 117 | } | 199 | } |
| 118 | 200 | ||
| 119 | void | 201 | void |
| @@ -8,12 +8,24 @@ | |||
| 8 | #include "utils.h" | 8 | #include "utils.h" |
| 9 | 9 | ||
| 10 | void compose(Cube *c2, Cube *c1); /* Use c2 as an alg on c1 */ | 10 | void compose(Cube *c2, Cube *c1); /* Use c2 as an alg on c1 */ |
| 11 | void compose_centers(Cube *c2, Cube *c1); | ||
| 12 | void compose_corners(Cube *c2, Cube *c1); | ||
| 13 | void compose_edges(Cube *c2, Cube *c1); | ||
| 11 | void copy_cube(Cube *src, Cube *dst); | 14 | void copy_cube(Cube *src, Cube *dst); |
| 15 | void copy_cube_centers(Cube *src, Cube *dst); | ||
| 16 | void copy_cube_corners(Cube *src, Cube *dst); | ||
| 17 | void copy_cube_edges(Cube *src, Cube *dst); | ||
| 12 | bool equal(Cube *c1, Cube *c2); | 18 | bool equal(Cube *c1, Cube *c2); |
| 13 | void invert_cube(Cube *cube); | 19 | void invert_cube(Cube *cube); |
| 20 | void invert_cube_centers(Cube *cube); | ||
| 21 | void invert_cube_corners(Cube *cube); | ||
| 22 | void invert_cube_edges(Cube *cube); | ||
| 14 | bool is_admissible(Cube *cube); | 23 | bool is_admissible(Cube *cube); |
| 15 | bool is_solved(Cube *cube); | 24 | bool is_solved(Cube *cube); |
| 16 | void make_solved(Cube *cube); | 25 | void make_solved(Cube *cube); |
| 26 | void make_solved_centers(Cube *cube); | ||
| 27 | void make_solved_corners(Cube *cube); | ||
| 28 | void make_solved_edges(Cube *cube); | ||
| 17 | void print_cube(Cube *cube); | 29 | void print_cube(Cube *cube); |
| 18 | int where_is_center(Center x, Cube *c); | 30 | int where_is_center(Center x, Cube *c); |
| 19 | int where_is_corner(Corner k, Cube *c); | 31 | int where_is_corner(Corner k, Cube *c); |
| @@ -3,7 +3,6 @@ | |||
| 3 | #include "fst.h" | 3 | #include "fst.h" |
| 4 | 4 | ||
| 5 | static FstCube ep_to_fst_epos(int *ep); | 5 | static FstCube ep_to_fst_epos(int *ep); |
| 6 | static int fst_where_is_edge(int e, FstCube fst); | ||
| 7 | static void transform_ep_only(Trans t, int *ep, Cube *dst); | 6 | static void transform_ep_only(Trans t, int *ep, Cube *dst); |
| 8 | static void init_fst_corner_invtables(); | 7 | static void init_fst_corner_invtables(); |
| 9 | static void init_fst_eo_invtables(); | 8 | static void init_fst_eo_invtables(); |
| @@ -55,7 +54,10 @@ cube_to_fst(Cube *cube) | |||
| 55 | static FstCube | 54 | static FstCube |
| 56 | ep_to_fst_epos(int *ep) | 55 | ep_to_fst_epos(int *ep) |
| 57 | { | 56 | { |
| 58 | /* TODO: maybe optimize? */ | 57 | /* TODO: maybe optimize */ |
| 58 | |||
| 59 | /* TODO: this version if faster, but broken | ||
| 60 | probably need to fix transform_ep_only() | ||
| 59 | 61 | ||
| 60 | FstCube ret; | 62 | FstCube ret; |
| 61 | Cube c; | 63 | Cube c; |
| @@ -68,6 +70,24 @@ ep_to_fst_epos(int *ep) | |||
| 68 | 70 | ||
| 69 | transform_ep_only(rd, ep, &c); | 71 | transform_ep_only(rd, ep, &c); |
| 70 | ret.rd_eposepe = coord_eposepe.i[0]->index(&c); | 72 | ret.rd_eposepe = coord_eposepe.i[0]->index(&c); |
| 73 | */ | ||
| 74 | |||
| 75 | FstCube ret; | ||
| 76 | Cube c, d; | ||
| 77 | |||
| 78 | make_solved(&c); | ||
| 79 | memcpy(c.ep, ep, 12 * sizeof(int)); | ||
| 80 | |||
| 81 | copy_cube(&c, &d); | ||
| 82 | ret.uf_eposepe = coord_eposepe.i[0]->index(&d); | ||
| 83 | |||
| 84 | copy_cube(&c, &d); | ||
| 85 | apply_trans(fr, &d); | ||
| 86 | ret.fr_eposepe = coord_eposepe.i[0]->index(&d); | ||
| 87 | |||
| 88 | copy_cube(&c, &d); | ||
| 89 | apply_trans(rd, &d); | ||
| 90 | ret.rd_eposepe = coord_eposepe.i[0]->index(&d); | ||
| 71 | 91 | ||
| 72 | return ret; | 92 | return ret; |
| 73 | } | 93 | } |
| @@ -155,7 +175,7 @@ fst_to_cube(FstCube fst, Cube *cube) | |||
| 155 | cube->xp[i] = i; | 175 | cube->xp[i] = i; |
| 156 | } | 176 | } |
| 157 | 177 | ||
| 158 | static int | 178 | int |
| 159 | fst_where_is_edge(int e, FstCube fst) | 179 | fst_where_is_edge(int e, FstCube fst) |
| 160 | { | 180 | { |
| 161 | switch (edge_slice[e]) { | 181 | switch (edge_slice[e]) { |
| @@ -183,6 +203,10 @@ void | |||
| 183 | init_fst() | 203 | init_fst() |
| 184 | { | 204 | { |
| 185 | init_trans(); | 205 | init_trans(); |
| 206 | gen_coord(&coord_eofb); | ||
| 207 | gen_coord(&coord_eposepe); | ||
| 208 | gen_coord(&coord_coud); | ||
| 209 | gen_coord(&coord_cp); | ||
| 186 | 210 | ||
| 187 | init_fst_corner_invtables(); | 211 | init_fst_corner_invtables(); |
| 188 | init_fst_eo_invtables(); | 212 | init_fst_eo_invtables(); |
| @@ -193,32 +217,29 @@ init_fst() | |||
| 193 | static void | 217 | static void |
| 194 | init_fst_corner_invtables() | 218 | init_fst_corner_invtables() |
| 195 | { | 219 | { |
| 196 | /* TODO: this can be optimized by transforming and copying only corners */ | ||
| 197 | /* A factor of about 4 would be saved in the innermost loop */ | ||
| 198 | |||
| 199 | Cube c, d; | 220 | Cube c, d; |
| 200 | uint64_t cp, coud; | 221 | uint64_t cp, coud; |
| 201 | 222 | ||
| 202 | for (cp = 0; cp < FACTORIAL8; cp++) { | 223 | for (cp = 0; cp < FACTORIAL8; cp++) { |
| 203 | make_solved(&c); | 224 | make_solved_corners(&c); |
| 204 | coord_cp.i[0]->to_cube(cp, &c); | 225 | coord_cp.i[0]->to_cube(cp, &c); |
| 205 | 226 | ||
| 206 | copy_cube(&c, &d); | 227 | copy_cube_corners(&c, &d); |
| 207 | invert_cube(&d); | 228 | invert_cube_corners(&d); |
| 208 | inv_cp[cp] = coord_coud.i[0]->index(&d); | 229 | inv_cp[cp] = coord_cp.i[0]->index(&d); |
| 209 | 230 | ||
| 210 | for (coud = 0; coud < POW3TO7; coud++) { | 231 | for (coud = 0; coud < POW3TO7; coud++) { |
| 211 | copy_cube(&c, &d); | 232 | copy_cube_corners(&c, &d); |
| 212 | coord_coud.i[0]->to_cube(coud, &d); | 233 | coord_coud.i[0]->to_cube(coud, &d); |
| 213 | invert_cube(&d); | 234 | invert_cube_corners(&d); |
| 214 | inv_coud[cp][coud] = coord_coud.i[0]->index(&d); | 235 | inv_coud[cp][coud] = coord_coud.i[0]->index(&d); |
| 215 | } | 236 | } |
| 216 | 237 | ||
| 217 | copy_cube(&c, &d); | 238 | copy_cube_corners(&c, &d); |
| 218 | apply_trans(fr, &d); | 239 | apply_trans(fr, &d); |
| 219 | uf_cp_to_fr_cp[cp] = coord_cp.i[0]->index(&d); | 240 | uf_cp_to_fr_cp[cp] = coord_cp.i[0]->index(&d); |
| 220 | 241 | ||
| 221 | copy_cube(&c, &d); | 242 | copy_cube_corners(&c, &d); |
| 222 | apply_trans(rd, &d); | 243 | apply_trans(rd, &d); |
| 223 | uf_cp_to_rd_cp[cp] = coord_cp.i[0]->index(&d); | 244 | uf_cp_to_rd_cp[cp] = coord_cp.i[0]->index(&d); |
| 224 | } | 245 | } |
| @@ -234,13 +255,17 @@ init_fst_eo_invtables() | |||
| 234 | make_solved(&c); | 255 | make_solved(&c); |
| 235 | coord_eposepe.i[0]->to_cube(ep, &c); | 256 | coord_eposepe.i[0]->to_cube(ep, &c); |
| 236 | for (eo = 0; eo < POW2TO11; eo++) { | 257 | for (eo = 0; eo < POW2TO11; eo++) { |
| 237 | coord_eofb.i[0]->to_cube(eo, &c); | 258 | copy_cube_edges(&c, &d); |
| 238 | copy_cube(&c, &d); | 259 | coord_eofb.i[0]->to_cube(eo, &d); |
| 239 | init_fst_eo_update(eo, ep, 0, &d); | 260 | init_fst_eo_update(eo, ep, 0, &d); |
| 261 | |||
| 240 | apply_trans(inverse_trans(fr), &d); | 262 | apply_trans(inverse_trans(fr), &d); |
| 263 | coord_eofb.i[0]->to_cube(eo, &d); | ||
| 241 | init_fst_eo_update(eo, ep, 1, &d); | 264 | init_fst_eo_update(eo, ep, 1, &d); |
| 242 | copy_cube(&c, &d); | 265 | |
| 266 | copy_cube_edges(&c, &d); | ||
| 243 | apply_trans(inverse_trans(rd), &d); | 267 | apply_trans(inverse_trans(rd), &d); |
| 268 | coord_eofb.i[0]->to_cube(eo, &d); | ||
| 244 | init_fst_eo_update(eo, ep, 2, &d); | 269 | init_fst_eo_update(eo, ep, 2, &d); |
| 245 | } | 270 | } |
| 246 | } | 271 | } |
| @@ -251,9 +276,11 @@ init_fst_eo_update(uint64_t eo, uint64_t ep, int s, Cube *d) | |||
| 251 | { | 276 | { |
| 252 | int i; | 277 | int i; |
| 253 | 278 | ||
| 254 | for (i = 0; i < 12; i++) | 279 | for (i = 0; i < 12; i++) { |
| 255 | if (d->eo[i]) | 280 | if (edge_slice[d->ep[i]] == s && d->eo[i] && d->ep[i] != 11) |
| 256 | eo_invtable[s][eo][ep] |= ((uint16_t)1) << d->ep[i]; | 281 | eo_invtable[s][eo][ep] |= |
| 282 | ((uint16_t)1) << ((uint16_t)d->ep[i]); | ||
| 283 | } | ||
| 257 | } | 284 | } |
| 258 | 285 | ||
| 259 | static void | 286 | static void |
| @@ -270,7 +297,7 @@ init_fst_transalg() | |||
| 270 | apply_alg(alg, &c); | 297 | apply_alg(alg, &c); |
| 271 | for (i = 0; i < 12; i++) | 298 | for (i = 0; i < 12; i++) |
| 272 | trans_ep_alg[t][i] = c.ep[i]; | 299 | trans_ep_alg[t][i] = c.ep[i]; |
| 273 | invert_cube(&c); | 300 | invert_cube_edges(&c); |
| 274 | for (i = 0; i < 12; i++) | 301 | for (i = 0; i < 12; i++) |
| 275 | trans_ep_inv[t][i] = c.ep[i]; | 302 | trans_ep_inv[t][i] = c.ep[i]; |
| 276 | } | 303 | } |
| @@ -286,20 +313,20 @@ init_fst_where_is_edge() | |||
| 286 | for (e = 0; e < BINOM12ON4 * FACTORIAL4; e++) { | 313 | for (e = 0; e < BINOM12ON4 * FACTORIAL4; e++) { |
| 287 | coord_eposepe.i[0]->to_cube(e, &c); | 314 | coord_eposepe.i[0]->to_cube(e, &c); |
| 288 | 315 | ||
| 289 | copy_cube(&c, &d); | 316 | copy_cube_edges(&c, &d); |
| 290 | fst_where_is_edge_arr[0][FR][e] = where_is_edge(FR, &d); | 317 | fst_where_is_edge_arr[0][FR][e] = where_is_edge(FR, &d); |
| 291 | fst_where_is_edge_arr[0][FL][e] = where_is_edge(FL, &d); | 318 | fst_where_is_edge_arr[0][FL][e] = where_is_edge(FL, &d); |
| 292 | fst_where_is_edge_arr[0][BL][e] = where_is_edge(BL, &d); | 319 | fst_where_is_edge_arr[0][BL][e] = where_is_edge(BL, &d); |
| 293 | fst_where_is_edge_arr[0][BR][e] = where_is_edge(BR, &d); | 320 | fst_where_is_edge_arr[0][BR][e] = where_is_edge(BR, &d); |
| 294 | 321 | ||
| 295 | copy_cube(&c, &d); | 322 | copy_cube_edges(&c, &d); |
| 296 | apply_trans(inverse_trans(fr), &d); | 323 | apply_trans(inverse_trans(fr), &d); |
| 297 | fst_where_is_edge_arr[1][UL][e] = where_is_edge(UL, &d); | 324 | fst_where_is_edge_arr[1][UL][e] = where_is_edge(UL, &d); |
| 298 | fst_where_is_edge_arr[1][UR][e] = where_is_edge(UR, &d); | 325 | fst_where_is_edge_arr[1][UR][e] = where_is_edge(UR, &d); |
| 299 | fst_where_is_edge_arr[1][DL][e] = where_is_edge(DL, &d); | 326 | fst_where_is_edge_arr[1][DL][e] = where_is_edge(DL, &d); |
| 300 | fst_where_is_edge_arr[1][DR][e] = where_is_edge(DR, &d); | 327 | fst_where_is_edge_arr[1][DR][e] = where_is_edge(DR, &d); |
| 301 | 328 | ||
| 302 | copy_cube(&c, &d); | 329 | copy_cube_edges(&c, &d); |
| 303 | apply_trans(inverse_trans(rd), &d); | 330 | apply_trans(inverse_trans(rd), &d); |
| 304 | fst_where_is_edge_arr[2][UF][e] = where_is_edge(UF, &d); | 331 | fst_where_is_edge_arr[2][UF][e] = where_is_edge(UF, &d); |
| 305 | fst_where_is_edge_arr[2][UB][e] = where_is_edge(UB, &d); | 332 | fst_where_is_edge_arr[2][UB][e] = where_is_edge(UB, &d); |
| @@ -7,6 +7,7 @@ FstCube cube_to_fst(Cube *cube); | |||
| 7 | FstCube fst_inverse(FstCube fst); | 7 | FstCube fst_inverse(FstCube fst); |
| 8 | FstCube fst_move(Move m, FstCube fst); | 8 | FstCube fst_move(Move m, FstCube fst); |
| 9 | void fst_to_cube(FstCube fst, Cube *cube); | 9 | void fst_to_cube(FstCube fst, Cube *cube); |
| 10 | int fst_where_is_edge(int e, FstCube fst); | ||
| 10 | void init_fst(); | 11 | void init_fst(); |
| 11 | 12 | ||
| 12 | #endif | 13 | #endif |
diff --git a/src/moves.c b/src/moves.c index 51012db..a9dfdc0 100644 --- a/src/moves.c +++ b/src/moves.c | |||
| @@ -106,6 +106,24 @@ apply_move(Move m, Cube *cube) | |||
| 106 | compose(&move_array[m], cube); | 106 | compose(&move_array[m], cube); |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | void | ||
| 110 | apply_move_centers(Move m, Cube *cube) | ||
| 111 | { | ||
| 112 | compose_centers(&move_array[m], cube); | ||
| 113 | } | ||
| 114 | |||
| 115 | void | ||
| 116 | apply_move_corners(Move m, Cube *cube) | ||
| 117 | { | ||
| 118 | compose_corners(&move_array[m], cube); | ||
| 119 | } | ||
| 120 | |||
| 121 | void | ||
| 122 | apply_move_edges(Move m, Cube *cube) | ||
| 123 | { | ||
| 124 | compose_edges(&move_array[m], cube); | ||
| 125 | } | ||
| 126 | |||
| 109 | Alg * | 127 | Alg * |
| 110 | cleanup(Alg *alg) | 128 | cleanup(Alg *alg) |
| 111 | { | 129 | { |
diff --git a/src/moves.h b/src/moves.h index 4afe8fb..4e8be7f 100644 --- a/src/moves.h +++ b/src/moves.h | |||
| @@ -7,6 +7,9 @@ | |||
| 7 | 7 | ||
| 8 | void apply_alg(Alg *alg, Cube *cube); | 8 | void apply_alg(Alg *alg, Cube *cube); |
| 9 | void apply_move(Move m, Cube *cube); | 9 | void apply_move(Move m, Cube *cube); |
| 10 | void apply_move_centers(Move m, Cube *cube); | ||
| 11 | void apply_move_corners(Move m, Cube *cube); | ||
| 12 | void apply_move_edges(Move m, Cube *cube); | ||
| 10 | Alg * cleanup(Alg *alg); | 13 | Alg * cleanup(Alg *alg); |
| 11 | 14 | ||
| 12 | void init_moves(); | 15 | void init_moves(); |
