aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cube.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/cube.c b/src/cube.c
index 4e038c7..24cca4d 100644
--- a/src/cube.c
+++ b/src/cube.c
@@ -641,23 +641,22 @@ where_is_corner(Cube cube, Corner c)
641} 641}
642 642
643Edge 643Edge
644where_is_edge(Cube cube, Edge e) 644where_is_edge(Cube c, Edge e)
645{ 645{
646 /* TODO: when I wrote this code I forgot to add the final 646 int r0, r1, r2;
647 part, and now I can't remember how it was supposed to
648 work (i.e. how to recover the location of the edge
649 from these tables. I think it is either very easy or
650 wrong, in any case it is not a priority now.
651 Future Seba can deal with it.
652 647
653 static bool initialized = false; 648 static bool initialized = false;
654 static Edge aux[3][FACTORIAL12/FACTORIAL8][12]; 649 static int aux[3][BINOM12ON4*FACTORIAL4][12];
655 static int i; 650 static int i, j;
656 static unsigned int ui; 651 static unsigned int ui;
657 static CubeArray *arr; 652 static CubeArray *arr;
658 653
659 if (!initialized) { 654 if (!initialized) {
660 for (ui = 0; ui < FACTORIAL12/FACTORIAL8; ui++) { 655 for (ui = 0; ui < BINOM12ON4*FACTORIAL4; ui++) {
656 for (i = 0; i < 3; i++)
657 for (j = 0; j < 12; j++)
658 aux[i][ui][j] = -1;
659
661 arr = new_cubearray((Cube){.epose = ui}, pf_e); 660 arr = new_cubearray((Cube){.epose = ui}, pf_e);
662 for (i = 0; i < 12; i++) 661 for (i = 0; i < 12; i++)
663 if (edge_slice(arr->ep[i]) == 0) 662 if (edge_slice(arr->ep[i]) == 0)
@@ -679,14 +678,9 @@ where_is_edge(Cube cube, Edge e)
679 678
680 initialized = true; 679 initialized = true;
681 } 680 }
682 */
683
684 int i;
685 CubeArray *arr = new_cubearray(cube, pf_ep);
686 681
687 for (i = 0; i < 12; i++) 682 r0 = aux[0][c.epose][e];
688 if ((Edge)arr->ep[i] == e) 683 r1 = aux[1][c.eposs][e];
689 return i; 684 r2 = aux[2][c.eposm][e];
690 685 return MAX(r0, MAX(r1, r2));
691 return -1;
692} 686}

Generated with cgit - Back to sebastiano.tronto.net