diff options
Diffstat (limited to 'src/cube.c')
| -rw-r--r-- | src/cube.c | 14 |
1 files changed, 9 insertions, 5 deletions
| @@ -5,7 +5,7 @@ | |||
| 5 | int | 5 | int |
| 6 | array_ep_to_epos(int *ep, int *ss) | 6 | array_ep_to_epos(int *ep, int *ss) |
| 7 | { | 7 | { |
| 8 | int epos[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; | 8 | int epos[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 9 | int eps[4]; | 9 | int eps[4]; |
| 10 | int i, j, is; | 10 | int i, j, is; |
| 11 | 11 | ||
| @@ -287,11 +287,15 @@ equal(Cube c1, Cube c2) | |||
| 287 | Cube | 287 | Cube |
| 288 | inverse_cube(Cube cube) | 288 | inverse_cube(Cube cube) |
| 289 | { | 289 | { |
| 290 | CubeArray *arr = new_cubearray(cube, pf_all); | 290 | CubeArray *arr, *inv; |
| 291 | CubeArray *inv = new_cubearray((Cube){0}, pf_all); | ||
| 292 | Cube ret; | 291 | Cube ret; |
| 293 | int i; | 292 | int i; |
| 294 | 293 | ||
| 294 | arr = new_cubearray((Cube){0}, pf_all); | ||
| 295 | inv = new_cubearray((Cube){0}, pf_all); | ||
| 296 | |||
| 297 | cube_to_arrays(cube, arr, pf_all); | ||
| 298 | |||
| 295 | for (i = 0; i < 12; i++) { | 299 | for (i = 0; i < 12; i++) { |
| 296 | inv->ep[arr->ep[i]] = i; | 300 | inv->ep[arr->ep[i]] = i; |
| 297 | inv->eofb[arr->ep[i]] = arr->eofb[i]; | 301 | inv->eofb[arr->ep[i]] = arr->eofb[i]; |
| @@ -317,8 +321,8 @@ inverse_cube(Cube cube) | |||
| 317 | } | 321 | } |
| 318 | 322 | ||
| 319 | bool | 323 | bool |
| 320 | is_admissible(Cube cube) | 324 | is_admissible(Cube cube) { |
| 321 | { | 325 | |
| 322 | /* TODO: this should check consistency of different orientations */ | 326 | /* TODO: this should check consistency of different orientations */ |
| 323 | /* check also that centers are opposite and admissible */ | 327 | /* check also that centers are opposite and admissible */ |
| 324 | 328 | ||
