From f021ee7fa4975eab02c158451093a28e83a725d9 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 31 May 2022 17:29:08 +0200 Subject: Big changes to coordinate system: remove "anti-index" in favor of a more kociemba-like move function for each coordinate. This should speedup the table generation step. WARNING: nissy might not be 100% functional at this stage, TESTING needed! --- src/cube.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/cube.c') 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 @@ /* Local functions ***********************************************************/ -static void fix_eorleoud(CubeArray *arr); -static void fix_cofbcorl(CubeArray *arr); static void init_inverse(); static bool read_invtables_file(); static bool write_invtables_file(); @@ -125,6 +123,30 @@ cube_to_arrays(Cube cube, CubeArray *arr, PieceFilter f) index_to_perm(cube.cpos, 6, arr->cpos); } +void +epos_to_compatible_ep(int epos, int *ep, int *ss) +{ + int i, j, k, other[8]; + bool flag; + + for (i = 0; i < 12; i++) + ep[i] = -1; + + epos_to_partial_ep(epos, ep, ss); + + for (i = 0, j = 0; i < 12; i++) { + flag = false; + for (k = 0; k < 4; k++) + flag = flag || (i == ss[k]); + if (!flag) + other[j++] = i; + } + + for (i = 0, j = 0; i < 12; i++) + if (ep[i] == -1) + ep[i] = other[j++]; +} + void epos_to_partial_ep(int epos, int *ep, int *ss) { @@ -141,7 +163,7 @@ epos_to_partial_ep(int epos, int *ep, int *ss) ep[i] = ss[eps[is++]]; } -static void +void fix_eorleoud(CubeArray *arr) { int i; @@ -163,7 +185,7 @@ fix_eorleoud(CubeArray *arr) } } -static void +void fix_cofbcorl(CubeArray *arr) { int i; -- cgit v1.3