diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-03 13:41:24 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-12-03 13:41:24 +0100 |
| commit | 40c1aedcd2c8b770ea07ebf7fc22e83ec4b30cb3 (patch) | |
| tree | ec532ce9b7cc8df4e258b2c40cf0acfd73386422 /src/cube.c | |
| parent | d2e83077e9bbfcb7f8b4f9506d81cc98397f2e0a (diff) | |
| download | nissy-40c1aedcd2c8b770ea07ebf7fc22e83ec4b30cb3.tar.gz nissy-40c1aedcd2c8b770ea07ebf7fc22e83ec4b30cb3.zip | |
Some attempts at using the inverse scramble to get more info for pruning (optimal solving)
Diffstat (limited to '')
| -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 | ||
