diff options
Diffstat (limited to 'src/cube.c')
| -rw-r--r-- | src/cube.c | 19 |
1 files changed, 3 insertions, 16 deletions
| @@ -1,13 +1,8 @@ | |||
| 1 | #include "cube.h" | 1 | #include "cube.h" |
| 2 | 2 | ||
| 3 | /* Local functions **********************************************************/ | 3 | /* Public functions implementation *******************************************/ |
| 4 | |||
| 5 | static int array_ep_to_epos(int *ep, int *eps_solved); | ||
| 6 | static int epos_from_arrays(int *epos, int *ep); | ||
| 7 | |||
| 8 | /* Local functions implementation ********************************************/ | ||
| 9 | 4 | ||
| 10 | static int | 5 | int |
| 11 | array_ep_to_epos(int *ep, int *ss) | 6 | array_ep_to_epos(int *ep, int *ss) |
| 12 | { | 7 | { |
| 13 | 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 }; |
| @@ -26,17 +21,9 @@ array_ep_to_epos(int *ep, int *ss) | |||
| 26 | for (i = 0; i < 4; i++) | 21 | for (i = 0; i < 4; i++) |
| 27 | swap(&epos[ss[i]], &epos[i+8]); | 22 | swap(&epos[ss[i]], &epos[i+8]); |
| 28 | 23 | ||
| 29 | return epos_from_arrays(epos, eps); | 24 | return 24 * subset_to_index(epos, 12, 4) + perm_to_index(eps, 4); |
| 30 | } | 25 | } |
| 31 | 26 | ||
| 32 | static int | ||
| 33 | epos_from_arrays(int *epos, int *ep) | ||
| 34 | { | ||
| 35 | return FACTORIAL4 * subset_to_index(epos,12,4) + perm_to_index(ep,4); | ||
| 36 | } | ||
| 37 | |||
| 38 | /* Public functions implementation *******************************************/ | ||
| 39 | |||
| 40 | Cube | 27 | Cube |
| 41 | arrays_to_cube(CubeArray *arr, PieceFilter f) | 28 | arrays_to_cube(CubeArray *arr, PieceFilter f) |
| 42 | { | 29 | { |
