aboutsummaryrefslogtreecommitdiff
path: root/src/cube.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cube.c')
-rw-r--r--src/cube.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/cube.c b/src/cube.c
index 0ed862f..aae3a6e 100644
--- a/src/cube.c
+++ b/src/cube.c
@@ -2,8 +2,6 @@
2 2
3/* Local functions ***********************************************************/ 3/* Local functions ***********************************************************/
4 4
5static void fix_eorleoud(CubeArray *arr);
6static void fix_cofbcorl(CubeArray *arr);
7static void init_inverse(); 5static void init_inverse();
8static bool read_invtables_file(); 6static bool read_invtables_file();
9static bool write_invtables_file(); 7static bool write_invtables_file();
@@ -126,6 +124,30 @@ cube_to_arrays(Cube cube, CubeArray *arr, PieceFilter f)
126} 124}
127 125
128void 126void
127epos_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
150void
129epos_to_partial_ep(int epos, int *ep, int *ss) 151epos_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
144static void 166void
145fix_eorleoud(CubeArray *arr) 167fix_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
166static void 188void
167fix_cofbcorl(CubeArray *arr) 189fix_cofbcorl(CubeArray *arr)
168{ 190{
169 int i; 191 int i;

Generated with cgit - Back to sebastiano.tronto.net