diff options
Diffstat (limited to 'src/cube.c')
| -rw-r--r-- | src/cube.c | 30 |
1 files changed, 26 insertions, 4 deletions
| @@ -2,8 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | /* Local functions ***********************************************************/ | 3 | /* Local functions ***********************************************************/ |
| 4 | 4 | ||
| 5 | static void fix_eorleoud(CubeArray *arr); | ||
| 6 | static void fix_cofbcorl(CubeArray *arr); | ||
| 7 | static void init_inverse(); | 5 | static void init_inverse(); |
| 8 | static bool read_invtables_file(); | 6 | static bool read_invtables_file(); |
| 9 | static bool write_invtables_file(); | 7 | static bool write_invtables_file(); |
| @@ -126,6 +124,30 @@ cube_to_arrays(Cube cube, CubeArray *arr, PieceFilter f) | |||
| 126 | } | 124 | } |
| 127 | 125 | ||
| 128 | void | 126 | void |
| 127 | epos_to_compatible_ep(int epos, int *ep, int *ss) | ||
| 128 | { | ||
| 129 | int i, j, k, other[8]; | ||
| 130 | bool flag; | ||
| 131 | |||
| 132 | for (i = 0; i < 12; i++) | ||
| 133 | ep[i] = -1; | ||
| 134 | |||
| 135 | epos_to_partial_ep(epos, ep, ss); | ||
| 136 | |||
| 137 | for (i = 0, j = 0; i < 12; i++) { | ||
| 138 | flag = false; | ||
| 139 | for (k = 0; k < 4; k++) | ||
| 140 | flag = flag || (i == ss[k]); | ||
| 141 | if (!flag) | ||
| 142 | other[j++] = i; | ||
| 143 | } | ||
| 144 | |||
| 145 | for (i = 0, j = 0; i < 12; i++) | ||
| 146 | if (ep[i] == -1) | ||
| 147 | ep[i] = other[j++]; | ||
| 148 | } | ||
| 149 | |||
| 150 | void | ||
| 129 | epos_to_partial_ep(int epos, int *ep, int *ss) | 151 | epos_to_partial_ep(int epos, int *ep, int *ss) |
| 130 | { | 152 | { |
| 131 | int i, is, eposs[12], eps[4]; | 153 | int i, is, eposs[12], eps[4]; |
| @@ -141,7 +163,7 @@ epos_to_partial_ep(int epos, int *ep, int *ss) | |||
| 141 | ep[i] = ss[eps[is++]]; | 163 | ep[i] = ss[eps[is++]]; |
| 142 | } | 164 | } |
| 143 | 165 | ||
| 144 | static void | 166 | void |
| 145 | fix_eorleoud(CubeArray *arr) | 167 | fix_eorleoud(CubeArray *arr) |
| 146 | { | 168 | { |
| 147 | int i; | 169 | int i; |
| @@ -163,7 +185,7 @@ fix_eorleoud(CubeArray *arr) | |||
| 163 | } | 185 | } |
| 164 | } | 186 | } |
| 165 | 187 | ||
| 166 | static void | 188 | void |
| 167 | fix_cofbcorl(CubeArray *arr) | 189 | fix_cofbcorl(CubeArray *arr) |
| 168 | { | 190 | { |
| 169 | int i; | 191 | int i; |
