commit 3ab2f98170908277f70191846e84e5dde185a056
parent a18d4b0ba97b301193597a963a77a40ef7c2254b
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Sat, 13 Apr 2024 15:48:19 +0200
removed fast
Diffstat:
16 files changed, 879 insertions(+), 1000 deletions(-)
diff --git a/TODO.txt b/TODO.txt
@@ -0,0 +1,2 @@
+- add public method apply move inplace
+- make apply moves work inplace?
diff --git a/constants.h b/constants.h
@@ -0,0 +1,786 @@
+#define NORMAL 0
+#define INVERSE 1
+
+#define _2p11 2048U
+#define _2p12 4096U
+#define _3p7 2187U
+#define _3p8 6561U
+#define _12c4 495U
+#define _8c4 70U
+
+#define _c_ufr 0U
+#define _c_ubl 1U
+#define _c_dfl 2U
+#define _c_dbr 3U
+#define _c_ufl 4U
+#define _c_ubr 5U
+#define _c_dfr 6U
+#define _c_dbl 7U
+
+#define _e_uf 0U
+#define _e_ub 1U
+#define _e_db 2U
+#define _e_df 3U
+#define _e_ur 4U
+#define _e_ul 5U
+#define _e_dl 6U
+#define _e_dr 7U
+#define _e_fr 8U
+#define _e_fl 9U
+#define _e_bl 10U
+#define _e_br 11U
+
+#define _eoshift 4U
+#define _coshift 5U
+
+#define _pbits 0xFU
+#define _esepbit1 0x4U
+#define _esepbit2 0x8U
+#define _csepbit 0x4U
+#define _eobit 0x10U
+#define _cobits 0xF0U
+#define _cobits2 0x60U
+#define _ctwist_cw 0x20U
+#define _ctwist_ccw 0x40U
+#define _eflip 0x10U
+#define _error 0xFFU
+
+typedef enum {
+ U, U2, U3, D, D2, D3,
+ R, R2, R3, L, L2, L3,
+ F, F2, F3, B, B2, B3
+} move_t;
+
+typedef enum {
+ UFr, ULr, UBr, URr, DFr, DLr, DBr, DRr,
+ RUr, RFr, RDr, RBr, LUr, LFr, LDr, LBr,
+ FUr, FRr, FDr, FLr, BUr, BRr, BDr, BLr,
+
+ UFm, ULm, UBm, URm, DFm, DLm, DBm, DRm,
+ RUm, RFm, RDm, RBm, LUm, LFm, LDm, LBm,
+ FUm, FRm, FDm, FLm, BUm, BRm, BDm, BLm
+} trans_t;
+
+_static cube_t zero = { .corner = {0}, .edge = {0} };
+_static cube_t solved = {
+ .corner = {0, 1, 2, 3, 4, 5, 6, 7},
+ .edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
+};
+
+_static cube_t move_table[] = {
+ [U] = {
+ .corner = {5, 4, 2, 3, 0, 1, 6, 7},
+ .edge = {4, 5, 2, 3, 1, 0, 6, 7, 8, 9, 10, 11}
+ },
+ [U2] = {
+ .corner = {1, 0, 2, 3, 5, 4, 6, 7},
+ .edge = {1, 0, 2, 3, 5, 4, 6, 7, 8, 9, 10, 11}
+ },
+ [U3] = {
+ .corner = {4, 5, 2, 3, 1, 0, 6, 7},
+ .edge = {5, 4, 2, 3, 0, 1, 6, 7, 8, 9, 10, 11}
+ },
+ [D] = {
+ .corner = {0, 1, 7, 6, 4, 5, 2, 3},
+ .edge = {0, 1, 7, 6, 4, 5, 2, 3, 8, 9, 10, 11}
+ },
+ [D2] = {
+ .corner = {0, 1, 3, 2, 4, 5, 7, 6},
+ .edge = {0, 1, 3, 2, 4, 5, 7, 6, 8, 9, 10, 11}
+ },
+ [D3] = {
+ .corner = {0, 1, 6, 7, 4, 5, 3, 2},
+ .edge = {0, 1, 6, 7, 4, 5, 3, 2, 8, 9, 10, 11}
+ },
+ [R] = {
+ .corner = {70, 1, 2, 69, 4, 32, 35, 7},
+ .edge = {0, 1, 2, 3, 8, 5, 6, 11, 7, 9, 10, 4}
+ },
+ [R2] = {
+ .corner = {3, 1, 2, 0, 4, 6, 5, 7},
+ .edge = {0, 1, 2, 3, 7, 5, 6, 4, 11, 9, 10, 8}
+ },
+ [R3] = {
+ .corner = {69, 1, 2, 70, 4, 35, 32, 7},
+ .edge = {0, 1, 2, 3, 11, 5, 6, 8, 4, 9, 10, 7}
+ },
+ [L] = {
+ .corner = {0, 71, 68, 3, 33, 5, 6, 34},
+ .edge = {0, 1, 2, 3, 4, 10, 9, 7, 8, 5, 6, 11}
+ },
+ [L2] = {
+ .corner = {0, 2, 1, 3, 7, 5, 6, 4},
+ .edge = {0, 1, 2, 3, 4, 6, 5, 7, 8, 10, 9, 11}
+ },
+ [L3] = {
+ .corner = {0, 68, 71, 3, 34, 5, 6, 33},
+ .edge = {0, 1, 2, 3, 4, 9, 10, 7, 8, 6, 5, 11}
+ },
+ [F] = {
+ .corner = {36, 1, 38, 3, 66, 5, 64, 7},
+ .edge = {25, 1, 2, 24, 4, 5, 6, 7, 16, 19, 10, 11}
+ },
+ [F2] = {
+ .corner = {2, 1, 0, 3, 6, 5, 4, 7},
+ .edge = {3, 1, 2, 0, 4, 5, 6, 7, 9, 8, 10, 11}
+ },
+ [F3] = {
+ .corner = {38, 1, 36, 3, 64, 5, 66, 7},
+ .edge = {24, 1, 2, 25, 4, 5, 6, 7, 19, 16, 10, 11}
+ },
+ [B] = {
+ .corner = {0, 37, 2, 39, 4, 67, 6, 65},
+ .edge = {0, 27, 26, 3, 4, 5, 6, 7, 8, 9, 17, 18}
+ },
+ [B2] = {
+ .corner = {0, 3, 2, 1, 4, 7, 6, 5},
+ .edge = {0, 2, 1, 3, 4, 5, 6, 7, 8, 9, 11, 10}
+ },
+ [B3] = {
+ .corner = {0, 39, 2, 37, 4, 65, 6, 67},
+ .edge = {0, 26, 27, 3, 4, 5, 6, 7, 8, 9, 18, 17}
+ },
+};
+
+_static cube_t trans_table[][2] = {
+ [UFr] = {
+ [NORMAL] = {
+ .corner = {0, 1, 2, 3, 4, 5, 6, 7},
+ .edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
+ },
+ [INVERSE] = {
+ .corner = {0, 1, 2, 3, 4, 5, 6, 7},
+ .edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
+ }
+ },
+ [ULr] = {
+ [NORMAL] = {
+ .corner = {4, 5, 7, 6, 1, 0, 2, 3},
+ .edge = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24}
+ },
+ [INVERSE] = {
+ .corner = {5, 4, 6, 7, 0, 1, 3, 2},
+ .edge = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26}
+ }
+ },
+ [UBr] = {
+ [NORMAL] = {
+ .corner = {1, 0, 3, 2, 5, 4, 7, 6},
+ .edge = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9}
+ },
+ [INVERSE] = {
+ .corner = {1, 0, 3, 2, 5, 4, 7, 6},
+ .edge = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9}
+ }
+ },
+ [URr] = {
+ [NORMAL] = {
+ .corner = {5, 4, 6, 7, 0, 1, 3, 2},
+ .edge = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26}
+ },
+ [INVERSE] = {
+ .corner = {4, 5, 7, 6, 1, 0, 2, 3},
+ .edge = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24}
+ }
+ },
+ [DFr] = {
+ [NORMAL] = {
+ .corner = {2, 3, 0, 1, 6, 7, 4, 5},
+ .edge = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10}
+ },
+ [INVERSE] = {
+ .corner = {2, 3, 0, 1, 6, 7, 4, 5},
+ .edge = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10}
+ }
+ },
+ [DLr] = {
+ [NORMAL] = {
+ .corner = {7, 6, 4, 5, 2, 3, 1, 0},
+ .edge = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27}
+ },
+ [INVERSE] = {
+ .corner = {7, 6, 4, 5, 2, 3, 1, 0},
+ .edge = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27}
+ }
+ },
+ [DBr] = {
+ [NORMAL] = {
+ .corner = {3, 2, 1, 0, 7, 6, 5, 4},
+ .edge = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8}
+ },
+ [INVERSE] = {
+ .corner = {3, 2, 1, 0, 7, 6, 5, 4},
+ .edge = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8}
+ }
+ },
+ [DRr] = {
+ [NORMAL] = {
+ .corner = {6, 7, 5, 4, 3, 2, 0, 1},
+ .edge = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25}
+ },
+ [INVERSE] = {
+ .corner = {6, 7, 5, 4, 3, 2, 0, 1},
+ .edge = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25}
+ }
+ },
+ [RUr] = {
+ [NORMAL] = {
+ .corner = {64, 67, 65, 66, 37, 38, 36, 39},
+ .edge = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3}
+ },
+ [INVERSE] = {
+ .corner = {32, 34, 35, 33, 70, 68, 69, 71},
+ .edge = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21}
+ }
+ },
+ [RFr] = {
+ [NORMAL] = {
+ .corner = {38, 37, 36, 39, 64, 67, 66, 65},
+ .edge = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18}
+ },
+ [INVERSE] = {
+ .corner = {36, 39, 38, 37, 66, 65, 64, 67},
+ .edge = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17}
+ }
+ },
+ [RDr] = {
+ [NORMAL] = {
+ .corner = {67, 64, 66, 65, 38, 37, 39, 36},
+ .edge = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1}
+ },
+ [INVERSE] = {
+ .corner = {33, 35, 34, 32, 71, 69, 68, 70},
+ .edge = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20}
+ }
+ },
+ [RBr] = {
+ [NORMAL] = {
+ .corner = {37, 38, 39, 36, 67, 64, 65, 66},
+ .edge = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16}
+ },
+ [INVERSE] = {
+ .corner = {37, 38, 39, 36, 67, 64, 65, 66},
+ .edge = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16}
+ }
+ },
+ [LUr] = {
+ [NORMAL] = {
+ .corner = {65, 66, 64, 67, 36, 39, 37, 38},
+ .edge = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2}
+ },
+ [INVERSE] = {
+ .corner = {34, 32, 33, 35, 68, 70, 71, 69},
+ .edge = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23}
+ }
+ },
+ [LFr] = {
+ [NORMAL] = {
+ .corner = {36, 39, 38, 37, 66, 65, 64, 67},
+ .edge = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17}
+ },
+ [INVERSE] = {
+ .corner = {38, 37, 36, 39, 64, 67, 66, 65},
+ .edge = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18}
+ }
+ },
+ [LDr] = {
+ [NORMAL] = {
+ .corner = {66, 65, 67, 64, 39, 36, 38, 37},
+ .edge = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0}
+ },
+ [INVERSE] = {
+ .corner = {35, 33, 32, 34, 69, 71, 70, 68},
+ .edge = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22}
+ }
+ },
+ [LBr] = {
+ [NORMAL] = {
+ .corner = {39, 36, 37, 38, 65, 66, 67, 64},
+ .edge = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19}
+ },
+ [INVERSE] = {
+ .corner = {39, 36, 37, 38, 65, 66, 67, 64},
+ .edge = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19}
+ }
+ },
+ [FUr] = {
+ [NORMAL] = {
+ .corner = {68, 70, 69, 71, 32, 34, 33, 35},
+ .edge = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6}
+ },
+ [INVERSE] = {
+ .corner = {68, 70, 69, 71, 32, 34, 33, 35},
+ .edge = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6}
+ }
+ },
+ [FRr] = {
+ [NORMAL] = {
+ .corner = {32, 34, 35, 33, 70, 68, 69, 71},
+ .edge = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21}
+ },
+ [INVERSE] = {
+ .corner = {64, 67, 65, 66, 37, 38, 36, 39},
+ .edge = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3}
+ }
+ },
+ [FDr] = {
+ [NORMAL] = {
+ .corner = {70, 68, 71, 69, 34, 32, 35, 33},
+ .edge = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4}
+ },
+ [INVERSE] = {
+ .corner = {69, 71, 68, 70, 33, 35, 32, 34},
+ .edge = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7}
+ }
+ },
+ [FLr] = {
+ [NORMAL] = {
+ .corner = {34, 32, 33, 35, 68, 70, 71, 69},
+ .edge = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23}
+ },
+ [INVERSE] = {
+ .corner = {65, 66, 64, 67, 36, 39, 37, 38},
+ .edge = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2}
+ }
+ },
+ [BUr] = {
+ [NORMAL] = {
+ .corner = {69, 71, 68, 70, 33, 35, 32, 34},
+ .edge = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7}
+ },
+ [INVERSE] = {
+ .corner = {70, 68, 71, 69, 34, 32, 35, 33},
+ .edge = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4}
+ }
+ },
+ [BRr] = {
+ [NORMAL] = {
+ .corner = {35, 33, 32, 34, 69, 71, 70, 68},
+ .edge = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22}
+ },
+ [INVERSE] = {
+ .corner = {66, 65, 67, 64, 39, 36, 38, 37},
+ .edge = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0}
+ }
+ },
+ [BDr] = {
+ [NORMAL] = {
+ .corner = {71, 69, 70, 68, 35, 33, 34, 32},
+ .edge = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5}
+ },
+ [INVERSE] = {
+ .corner = {71, 69, 70, 68, 35, 33, 34, 32},
+ .edge = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5}
+ }
+ },
+ [BLr] = {
+ [NORMAL] = {
+ .corner = {33, 35, 34, 32, 71, 69, 68, 70},
+ .edge = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20}
+ },
+ [INVERSE] = {
+ .corner = {67, 64, 66, 65, 38, 37, 39, 36},
+ .edge = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1}
+ }
+ },
+ [UFm] = {
+ [NORMAL] = {
+ .corner = {4, 5, 6, 7, 0, 1, 2, 3},
+ .edge = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10}
+ },
+ [INVERSE] = {
+ .corner = {4, 5, 6, 7, 0, 1, 2, 3},
+ .edge = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10}
+ }
+ },
+ [ULm] = {
+ [NORMAL] = {
+ .corner = {0, 1, 3, 2, 5, 4, 6, 7},
+ .edge = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25}
+ },
+ [INVERSE] = {
+ .corner = {0, 1, 3, 2, 5, 4, 6, 7},
+ .edge = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25}
+ }
+ },
+ [UBm] = {
+ [NORMAL] = {
+ .corner = {5, 4, 7, 6, 1, 0, 3, 2},
+ .edge = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8}
+ },
+ [INVERSE] = {
+ .corner = {5, 4, 7, 6, 1, 0, 3, 2},
+ .edge = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8}
+ }
+ },
+ [URm] = {
+ [NORMAL] = {
+ .corner = {1, 0, 2, 3, 4, 5, 7, 6},
+ .edge = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27}
+ },
+ [INVERSE] = {
+ .corner = {1, 0, 2, 3, 4, 5, 7, 6},
+ .edge = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27}
+ }
+ },
+ [DFm] = {
+ [NORMAL] = {
+ .corner = {6, 7, 4, 5, 2, 3, 0, 1},
+ .edge = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11}
+ },
+ [INVERSE] = {
+ .corner = {6, 7, 4, 5, 2, 3, 0, 1},
+ .edge = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11}
+ }
+ },
+ [DLm] = {
+ [NORMAL] = {
+ .corner = {3, 2, 0, 1, 6, 7, 5, 4},
+ .edge = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26}
+ },
+ [INVERSE] = {
+ .corner = {2, 3, 1, 0, 7, 6, 4, 5},
+ .edge = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24}
+ }
+ },
+ [DBm] = {
+ [NORMAL] = {
+ .corner = {7, 6, 5, 4, 3, 2, 1, 0},
+ .edge = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9}
+ },
+ [INVERSE] = {
+ .corner = {7, 6, 5, 4, 3, 2, 1, 0},
+ .edge = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9}
+ }
+ },
+ [DRm] = {
+ [NORMAL] = {
+ .corner = {2, 3, 1, 0, 7, 6, 4, 5},
+ .edge = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24}
+ },
+ [INVERSE] = {
+ .corner = {3, 2, 0, 1, 6, 7, 5, 4},
+ .edge = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26}
+ }
+ },
+ [RUm] = {
+ [NORMAL] = {
+ .corner = {68, 71, 69, 70, 33, 34, 32, 35},
+ .edge = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3}
+ },
+ [INVERSE] = {
+ .corner = {70, 68, 69, 71, 32, 34, 35, 33},
+ .edge = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22}
+ }
+ },
+ [RFm] = {
+ [NORMAL] = {
+ .corner = {34, 33, 32, 35, 68, 71, 70, 69},
+ .edge = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18}
+ },
+ [INVERSE] = {
+ .corner = {66, 65, 64, 67, 36, 39, 38, 37},
+ .edge = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18}
+ }
+ },
+ [RDm] = {
+ [NORMAL] = {
+ .corner = {71, 68, 70, 69, 34, 33, 35, 32},
+ .edge = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1}
+ },
+ [INVERSE] = {
+ .corner = {71, 69, 68, 70, 33, 35, 34, 32},
+ .edge = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23}
+ }
+ },
+ [RBm] = {
+ [NORMAL] = {
+ .corner = {33, 34, 35, 32, 71, 68, 69, 70},
+ .edge = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16}
+ },
+ [INVERSE] = {
+ .corner = {67, 64, 65, 66, 37, 38, 39, 36},
+ .edge = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19}
+ }
+ },
+ [LUm] = {
+ [NORMAL] = {
+ .corner = {69, 70, 68, 71, 32, 35, 33, 34},
+ .edge = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2}
+ },
+ [INVERSE] = {
+ .corner = {68, 70, 71, 69, 34, 32, 33, 35},
+ .edge = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20}
+ }
+ },
+ [LFm] = {
+ [NORMAL] = {
+ .corner = {32, 35, 34, 33, 70, 69, 68, 71},
+ .edge = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17}
+ },
+ [INVERSE] = {
+ .corner = {64, 67, 66, 65, 38, 37, 36, 39},
+ .edge = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17}
+ }
+ },
+ [LDm] = {
+ [NORMAL] = {
+ .corner = {70, 69, 71, 68, 35, 32, 34, 33},
+ .edge = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0}
+ },
+ [INVERSE] = {
+ .corner = {69, 71, 70, 68, 35, 33, 32, 34},
+ .edge = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21}
+ }
+ },
+ [LBm] = {
+ [NORMAL] = {
+ .corner = {35, 32, 33, 34, 69, 70, 71, 68},
+ .edge = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19}
+ },
+ [INVERSE] = {
+ .corner = {65, 66, 67, 64, 39, 36, 37, 38},
+ .edge = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16}
+ }
+ },
+ [FUm] = {
+ [NORMAL] = {
+ .corner = {64, 66, 65, 67, 36, 38, 37, 39},
+ .edge = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7}
+ },
+ [INVERSE] = {
+ .corner = {32, 34, 33, 35, 68, 70, 69, 71},
+ .edge = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7}
+ }
+ },
+ [FRm] = {
+ [NORMAL] = {
+ .corner = {36, 38, 39, 37, 66, 64, 65, 67},
+ .edge = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20}
+ },
+ [INVERSE] = {
+ .corner = {37, 38, 36, 39, 64, 67, 65, 66},
+ .edge = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2}
+ }
+ },
+ [FDm] = {
+ [NORMAL] = {
+ .corner = {66, 64, 67, 65, 38, 36, 39, 37},
+ .edge = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5}
+ },
+ [INVERSE] = {
+ .corner = {33, 35, 32, 34, 69, 71, 68, 70},
+ .edge = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6}
+ }
+ },
+ [FLm] = {
+ [NORMAL] = {
+ .corner = {38, 36, 37, 39, 64, 66, 67, 65},
+ .edge = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22}
+ },
+ [INVERSE] = {
+ .corner = {36, 39, 37, 38, 65, 66, 64, 67},
+ .edge = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3}
+ }
+ },
+ [BUm] = {
+ [NORMAL] = {
+ .corner = {65, 67, 64, 66, 37, 39, 36, 38},
+ .edge = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6}
+ },
+ [INVERSE] = {
+ .corner = {34, 32, 35, 33, 70, 68, 71, 69},
+ .edge = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5}
+ }
+ },
+ [BRm] = {
+ [NORMAL] = {
+ .corner = {39, 37, 36, 38, 65, 67, 66, 64},
+ .edge = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23}
+ },
+ [INVERSE] = {
+ .corner = {39, 36, 38, 37, 66, 65, 67, 64},
+ .edge = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1}
+ }
+ },
+ [BDm] = {
+ [NORMAL] = {
+ .corner = {67, 65, 66, 64, 39, 37, 38, 36},
+ .edge = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4}
+ },
+ [INVERSE] = {
+ .corner = {35, 33, 34, 32, 71, 69, 70, 68},
+ .edge = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4}
+ }
+ },
+ [BLm] = {
+ [NORMAL] = {
+ .corner = {37, 39, 38, 36, 67, 65, 64, 66},
+ .edge = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21}
+ },
+ [INVERSE] = {
+ .corner = {38, 37, 39, 36, 67, 64, 66, 65},
+ .edge = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0}
+ }
+ },
+};
+
+_static char *cornerstr[] = {
+ [_c_ufr] = "UFR",
+ [_c_ubl] = "UBL",
+ [_c_dfl] = "DFL",
+ [_c_dbr] = "DBR",
+ [_c_ufl] = "UFL",
+ [_c_ubr] = "UBR",
+ [_c_dfr] = "DFR",
+ [_c_dbl] = "DBL"
+};
+
+_static char *cornerstralt[] = {
+ [_c_ufr] = "URF",
+ [_c_ubl] = "ULB",
+ [_c_dfl] = "DLF",
+ [_c_dbr] = "DRB",
+ [_c_ufl] = "ULF",
+ [_c_ubr] = "URB",
+ [_c_dfr] = "DRF",
+ [_c_dbl] = "DLB"
+};
+
+_static char *edgestr[] = {
+ [_e_uf] = "UF",
+ [_e_ub] = "UB",
+ [_e_db] = "DB",
+ [_e_df] = "DF",
+ [_e_ur] = "UR",
+ [_e_ul] = "UL",
+ [_e_dl] = "DL",
+ [_e_dr] = "DR",
+ [_e_fr] = "FR",
+ [_e_fl] = "FL",
+ [_e_bl] = "BL",
+ [_e_br] = "BR"
+};
+
+_static char *movestr[] = {
+ [U] = "U",
+ [U2] = "U2",
+ [U3] = "U'",
+ [D] = "D",
+ [D2] = "D2",
+ [D3] = "D'",
+ [R] = "R",
+ [R2] = "R2",
+ [R3] = "R'",
+ [L] = "L",
+ [L2] = "L2",
+ [L3] = "L'",
+ [F] = "F",
+ [F2] = "F2",
+ [F3] = "F'",
+ [B] = "B",
+ [B2] = "B2",
+ [B3] = "B'",
+};
+
+_static char *transstr[] = {
+ [UFr] = "rotation UF",
+ [UFm] = "mirrored UF",
+ [ULr] = "rotation UL",
+ [ULm] = "mirrored UL",
+ [UBr] = "rotation UB",
+ [UBm] = "mirrored UB",
+ [URr] = "rotation UR",
+ [URm] = "mirrored UR",
+ [DFr] = "rotation DF",
+ [DFm] = "mirrored DF",
+ [DLr] = "rotation DL",
+ [DLm] = "mirrored DL",
+ [DBr] = "rotation DB",
+ [DBm] = "mirrored DB",
+ [DRr] = "rotation DR",
+ [DRm] = "mirrored DR",
+ [RUr] = "rotation RU",
+ [RUm] = "mirrored RU",
+ [RFr] = "rotation RF",
+ [RFm] = "mirrored RF",
+ [RDr] = "rotation RD",
+ [RDm] = "mirrored RD",
+ [RBr] = "rotation RB",
+ [RBm] = "mirrored RB",
+ [LUr] = "rotation LU",
+ [LUm] = "mirrored LU",
+ [LFr] = "rotation LF",
+ [LFm] = "mirrored LF",
+ [LDr] = "rotation LD",
+ [LDm] = "mirrored LD",
+ [LBr] = "rotation LB",
+ [LBm] = "mirrored LB",
+ [FUr] = "rotation FU",
+ [FUm] = "mirrored FU",
+ [FRr] = "rotation FR",
+ [FRm] = "mirrored FR",
+ [FDr] = "rotation FD",
+ [FDm] = "mirrored FD",
+ [FLr] = "rotation FL",
+ [FLm] = "mirrored FL",
+ [BUr] = "rotation BU",
+ [BUm] = "mirrored BU",
+ [BRr] = "rotation BR",
+ [BRm] = "mirrored BR",
+ [BDr] = "rotation BD",
+ [BDm] = "mirrored BD",
+ [BLr] = "rotation BL",
+ [BLm] = "mirrored BL",
+};
+
+static uint8_t inverse_trans_table[48] = {
+ [UFr] = UFr,
+ [UFm] = UFm,
+ [ULr] = URr,
+ [ULm] = ULm,
+ [UBr] = UBr,
+ [UBm] = UBm,
+ [URr] = ULr,
+ [URm] = URm,
+ [DFr] = DFr,
+ [DFm] = DFm,
+ [DLr] = DLr,
+ [DLm] = DRm,
+ [DBr] = DBr,
+ [DBm] = DBm,
+ [DRr] = DRr,
+ [DRm] = DLm,
+ [RUr] = FRr,
+ [RUm] = FLm,
+ [RFr] = LFr,
+ [RFm] = RFm,
+ [RDr] = BLr,
+ [RDm] = BRm,
+ [RBr] = RBr,
+ [RBm] = LBm,
+ [LUr] = FLr,
+ [LUm] = FRm,
+ [LFr] = RFr,
+ [LFm] = LFm,
+ [LDr] = BRr,
+ [LDm] = BLm,
+ [LBr] = LBr,
+ [LBm] = RBm,
+ [FUr] = FUr,
+ [FUm] = FUm,
+ [FRr] = RUr,
+ [FRm] = LUm,
+ [FDr] = BUr,
+ [FDm] = BUm,
+ [FLr] = LUr,
+ [FLm] = RUm,
+ [BUr] = FDr,
+ [BUm] = FDm,
+ [BRr] = LDr,
+ [BRm] = RDm,
+ [BDr] = BDr,
+ [BDm] = BDm,
+ [BLr] = RDr,
+ [BLm] = LDm,
+};
diff --git a/cube.c b/cube.c
@@ -27,208 +27,9 @@
#endif
-#define _2p11 2048U
-#define _2p12 4096U
-#define _3p7 2187U
-#define _3p8 6561U
-#define _12c4 495U
-#define _8c4 70U
-
-#define _c_ufr 0U
-#define _c_ubl 1U
-#define _c_dfl 2U
-#define _c_dbr 3U
-#define _c_ufl 4U
-#define _c_ubr 5U
-#define _c_dfr 6U
-#define _c_dbl 7U
-
-#define _e_uf 0U
-#define _e_ub 1U
-#define _e_db 2U
-#define _e_df 3U
-#define _e_ur 4U
-#define _e_ul 5U
-#define _e_dl 6U
-#define _e_dr 7U
-#define _e_fr 8U
-#define _e_fl 9U
-#define _e_bl 10U
-#define _e_br 11U
-
-#define _eoshift 4U
-#define _coshift 5U
-
-#define _pbits 0xFU
-#define _esepbit1 0x4U
-#define _esepbit2 0x8U
-#define _csepbit 0x4U
-#define _eobit 0x10U
-#define _cobits 0xF0U
-#define _cobits2 0x60U
-#define _ctwist_cw 0x20U
-#define _ctwist_ccw 0x40U
-#define _eflip 0x10U
-#define _error 0xFFU
-
-typedef enum {
- U, U2, U3, D, D2, D3,
- R, R2, R3, L, L2, L3,
- F, F2, F3, B, B2, B3
-} move_t;
-
-typedef enum {
- UFr, ULr, UBr, URr, DFr, DLr, DBr, DRr,
- RUr, RFr, RDr, RBr, LUr, LFr, LDr, LBr,
- FUr, FRr, FDr, FLr, BUr, BRr, BDr, BLr,
-
- UFm, ULm, UBm, URm, DFm, DLm, DBm, DRm,
- RUm, RFm, RDm, RBm, LUm, LFm, LDm, LBm,
- FUm, FRm, FDm, FLm, BUm, BRm, BDm, BLm
-} trans_t;
-
-_static cube_t zero = { .corner = {0}, .edge = {0} };
-_static cube_t solved = {
- .corner = {0, 1, 2, 3, 4, 5, 6, 7},
- .edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
-};
-
-#include "tables.h"
-
-/******************************************************************************
-Section: portable fast methods
-
-This section contains performance-critical methods that do not use
-advanced CPU instructions. They are used as an alternative to the ones
-in the previous section(s) for unsupported architectures.
-******************************************************************************/
-
-typedef cube_t cube_fast_t;
-
-_static cube_fast_t cubetofast(cube_t);
-_static cube_t fasttocube(cube_fast_t);
-_static_inline bool equal_fast(cube_fast_t, cube_fast_t);
-_static_inline bool issolved_fast(cube_fast_t);
-_static_inline cube_fast_t invertco_fast(cube_fast_t);
-_static_inline cube_fast_t compose_fast(cube_fast_t, cube_fast_t);
-
-_static_inline int64_t coord_fast_co(cube_fast_t);
-_static_inline int64_t coord_fast_eo(cube_fast_t);
-
-_static cube_fast_t
-cubetofast(cube_t cube)
-{
- cube_fast_t fast;
- memcpy(&fast, &cube, sizeof(cube_fast_t));
- return fast;
-}
-
-_static cube_t
-fasttocube(cube_fast_t fast)
-{
- cube_t cube;
- memcpy(&cube, &fast, sizeof(cube_fast_t));
- return cube;
-}
-
-_static_inline bool
-equal_fast(cube_fast_t c1, cube_fast_t c2)
-{
- uint8_t i;
- bool ret;
-
- ret = true;
- for (i = 0; i < 8; i++)
- ret = ret && c1.corner[i] == c2.corner[i];
- for (i = 0; i < 12; i++)
- ret = ret && c1.edge[i] == c2.edge[i];
-
- return ret;
-}
-
-_static_inline bool
-issolved_fast(cube_fast_t cube)
-{
- return equal_fast(cube, solved);
-}
-
-_static_inline cube_fast_t
-invertco_fast(cube_fast_t c)
-{
- uint8_t i, piece, orien;
- cube_fast_t ret;
-
- ret = c;
- for (i = 0; i < 8; i++) {
- piece = c.corner[i];
- orien = ((piece << 1) | (piece >> 1)) & _cobits2;
- ret.corner[i] = (piece & _pbits) | orien;
- }
-
- return ret;
-}
-
-_static_inline cube_fast_t
-compose_fast(cube_fast_t c1, cube_fast_t c2)
-{
- cube_fast_t ret;
- uint8_t i, piece1, piece2, p, orien, aux, auy;
-
- ret = zero;
-
- for (i = 0; i < 12; i++) {
- piece2 = c2.edge[i];
- p = piece2 & _pbits;
- piece1 = c1.edge[p];
- orien = (piece2 ^ piece1) & _eobit;
- ret.edge[i] = (piece1 & _pbits) | orien;
- }
-
- for (i = 0; i < 8; i++) {
- piece2 = c2.corner[i];
- p = piece2 & _pbits;
- piece1 = c1.corner[p];
- aux = (piece2 & _cobits) + (piece1 & _cobits);
- auy = (aux + _ctwist_cw) >> 2U;
- orien = (aux + auy) & _cobits2;
- ret.corner[i] = (piece1 & _pbits) | orien;
- }
-
- return ret;
-}
-
-_static_inline int64_t
-coord_fast_co(cube_fast_t c)
-{
- int i, p;
- int64_t ret;
-
- for (ret = 0, i = 0, p = 1; i < 7; i++, p *= 3)
- ret += p * (c.corner[i] >> _coshift);
-
- return ret;
-}
-
-_static_inline int64_t
-coord_fast_eo(cube_fast_t c)
-{
- int i, p;
- int64_t ret;
-
- for (ret = 0, i = 1, p = 1; i < 12; i++, p *= 2)
- ret += p * (c.edge[i] >> _eoshift);
-
- return ret;
-}
-
-/******************************************************************************
-Section: generic methods
-
-This section contains generic functionality, including the public functions.
-Some of these routines depend on the efficient functions implemented in the
-previous sections, while some other operate directly on the cube.
-******************************************************************************/
+#include "constants.h"
+_static_inline cube_t invertco(cube_t);
_static int permsign(uint8_t *, int);
_static uint8_t readco(char *);
_static uint8_t readcp(char *);
@@ -245,8 +46,8 @@ _static uint8_t readmodifier(char);
_static uint8_t readtrans(char *);
_static int writemoves(uint8_t *, int, char *);
_static void writetrans(uint8_t, char *);
-_static cube_fast_t move(cube_fast_t, move_t);
-_static cube_fast_t transform(cube_fast_t, trans_t);
+_static cube_t move(cube_t, move_t);
+_static cube_t transform(cube_t, trans_t);
cube_t
cube_new(void)
@@ -393,10 +194,33 @@ cube_error(cube_t cube)
cube_t
cube_compose(cube_t c1, cube_t c2)
{
+ cube_t ret;
+ uint8_t i, piece1, piece2, p, orien, aux, auy;
+
DBG_ASSERT(cube_consistent(c1) && cube_consistent(c2),
zero, "cube_compose error: inconsistent cube\n")
- return fasttocube(compose_fast(cubetofast(c1), cubetofast(c2)));
+ ret = zero;
+
+ for (i = 0; i < 12; i++) {
+ piece2 = c2.edge[i];
+ p = piece2 & _pbits;
+ piece1 = c1.edge[p];
+ orien = (piece2 ^ piece1) & _eobit;
+ ret.edge[i] = (piece1 & _pbits) | orien;
+ }
+
+ for (i = 0; i < 8; i++) {
+ piece2 = c2.corner[i];
+ p = piece2 & _pbits;
+ piece1 = c1.corner[p];
+ aux = (piece2 & _cobits) + (piece1 & _cobits);
+ auy = (aux + _ctwist_cw) >> 2U;
+ orien = (aux + auy) & _cobits2;
+ ret.corner[i] = (piece1 & _pbits) | orien;
+ }
+
+ return ret;
}
cube_t
@@ -428,14 +252,14 @@ cube_inverse(cube_t cube)
cube_t
applymoves(cube_t cube, char *buf)
{
- cube_fast_t fast;
+ cube_t ret;
uint8_t r, m;
char *b;
DBG_ASSERT(cube_consistent(cube), zero,
"move error: inconsistent cube\n");
- fast = cubetofast(cube);
+ ret = cube_clone(cube);
for (b = buf; *b != '\0'; b++) {
while (*b == ' ' || *b == '\t' || *b == '\n')
@@ -446,11 +270,11 @@ applymoves(cube_t cube, char *buf)
goto applymoves_error;
if ((m = readmodifier(*(b+1))) != 0)
b++;
- fast = move(fast, r + m);
+ ret = move(ret, r + m);
}
applymoves_finish:
- return fasttocube(fast);
+ return ret;
applymoves_error:
DBG_LOG("applymoves error\n");
@@ -460,17 +284,41 @@ applymoves_error:
cube_t
applytrans(cube_t cube, char *buf)
{
- cube_fast_t fast;
+ cube_t ret;
uint8_t t;
DBG_ASSERT(cube_consistent(cube), zero,
"transformation error: inconsistent cube\n");
t = readtrans(buf);
- fast = cubetofast(cube);
- fast = transform(fast, t);
+ ret = cube_clone(cube);
+ ret = transform(ret, t);
- return fasttocube(fast);
+ return cube_clone(ret);
+}
+
+int64_t
+cube_coord_co(cube_t c)
+{
+ int i, p;
+ int64_t ret;
+
+ for (ret = 0, i = 0, p = 1; i < 7; i++, p *= 3)
+ ret += p * (c.corner[i] >> _coshift);
+
+ return ret;
+}
+
+int64_t
+cube_coord_eo(cube_t c)
+{
+ int i, p;
+ int64_t ret;
+
+ for (ret = 0, i = 1, p = 1; i < 12; i++, p *= 2)
+ ret += p * (c.edge[i] >> _eoshift);
+
+ return ret;
}
cube_t
@@ -808,14 +656,31 @@ writetrans(uint8_t t, char *buf)
buf[11] = '\0';
}
-_static cube_fast_t
-move(cube_fast_t c, move_t m)
+_static cube_t
+move(cube_t c, move_t m)
{
- return compose_fast(c, move_table[m]);
+ return cube_compose(c, move_table[m]);
+}
+
+_static_inline cube_t
+invertco(cube_t c)
+{
+ uint8_t i, piece, orien;
+ cube_t ret;
+
+ ret = c;
+ for (i = 0; i < 8; i++) {
+ piece = c.corner[i];
+ orien = ((piece << 1) | (piece >> 1)) & _cobits2;
+ ret.corner[i] = (piece & _pbits) | orien;
+ }
+
+ return ret;
}
-_static cube_fast_t
-transform(cube_fast_t c, trans_t t)
+
+_static cube_t
+transform(cube_t c, trans_t t)
{
cube_t tcube, tinv;
@@ -823,28 +688,15 @@ transform(cube_fast_t c, trans_t t)
tinv = trans_table[t][INVERSE];
return t < 24 ?
- compose_fast(compose_fast(tcube, c), tinv) :
- invertco_fast(compose_fast(compose_fast(tcube, c), tinv));
+ cube_compose(cube_compose(tcube, c), tinv) :
+ invertco(cube_compose(cube_compose(tcube, c), tinv));
}
+/* TODO: expose or remove, maybe add inverse move */
_static_inline uint8_t inverse_trans(uint8_t);
-_static_inline uint8_t movebase(uint8_t);
-_static_inline uint8_t moveaxis(uint8_t);
_static_inline uint8_t
inverse_trans(uint8_t t)
{
return inverse_trans_table[t];
}
-
-_static_inline uint8_t
-movebase(uint8_t move)
-{
- return move / 3;
-}
-
-_static_inline uint8_t
-moveaxis(uint8_t move)
-{
- return move / 6;
-}
diff --git a/cube.h b/cube.h
@@ -33,6 +33,9 @@ bool cube_error(cube_t);
cube_t cube_compose(cube_t, cube_t);
cube_t cube_inverse(cube_t);
+int64_t cube_coord_co(cube_t);
+int64_t cube_coord_eo(cube_t);
+
/******************************************************************************
Read / write utilities
diff --git a/debugcube.o b/debugcube.o
Binary files differ.
diff --git a/tables.h b/tables.h
@@ -1,720 +0,0 @@
-#define NORMAL 0
-#define INVERSE 1
-
-_static cube_t move_table[] = {
- [U] = {
- .corner = {5, 4, 2, 3, 0, 1, 6, 7},
- .edge = {4, 5, 2, 3, 1, 0, 6, 7, 8, 9, 10, 11}
- },
- [U2] = {
- .corner = {1, 0, 2, 3, 5, 4, 6, 7},
- .edge = {1, 0, 2, 3, 5, 4, 6, 7, 8, 9, 10, 11}
- },
- [U3] = {
- .corner = {4, 5, 2, 3, 1, 0, 6, 7},
- .edge = {5, 4, 2, 3, 0, 1, 6, 7, 8, 9, 10, 11}
- },
- [D] = {
- .corner = {0, 1, 7, 6, 4, 5, 2, 3},
- .edge = {0, 1, 7, 6, 4, 5, 2, 3, 8, 9, 10, 11}
- },
- [D2] = {
- .corner = {0, 1, 3, 2, 4, 5, 7, 6},
- .edge = {0, 1, 3, 2, 4, 5, 7, 6, 8, 9, 10, 11}
- },
- [D3] = {
- .corner = {0, 1, 6, 7, 4, 5, 3, 2},
- .edge = {0, 1, 6, 7, 4, 5, 3, 2, 8, 9, 10, 11}
- },
- [R] = {
- .corner = {70, 1, 2, 69, 4, 32, 35, 7},
- .edge = {0, 1, 2, 3, 8, 5, 6, 11, 7, 9, 10, 4}
- },
- [R2] = {
- .corner = {3, 1, 2, 0, 4, 6, 5, 7},
- .edge = {0, 1, 2, 3, 7, 5, 6, 4, 11, 9, 10, 8}
- },
- [R3] = {
- .corner = {69, 1, 2, 70, 4, 35, 32, 7},
- .edge = {0, 1, 2, 3, 11, 5, 6, 8, 4, 9, 10, 7}
- },
- [L] = {
- .corner = {0, 71, 68, 3, 33, 5, 6, 34},
- .edge = {0, 1, 2, 3, 4, 10, 9, 7, 8, 5, 6, 11}
- },
- [L2] = {
- .corner = {0, 2, 1, 3, 7, 5, 6, 4},
- .edge = {0, 1, 2, 3, 4, 6, 5, 7, 8, 10, 9, 11}
- },
- [L3] = {
- .corner = {0, 68, 71, 3, 34, 5, 6, 33},
- .edge = {0, 1, 2, 3, 4, 9, 10, 7, 8, 6, 5, 11}
- },
- [F] = {
- .corner = {36, 1, 38, 3, 66, 5, 64, 7},
- .edge = {25, 1, 2, 24, 4, 5, 6, 7, 16, 19, 10, 11}
- },
- [F2] = {
- .corner = {2, 1, 0, 3, 6, 5, 4, 7},
- .edge = {3, 1, 2, 0, 4, 5, 6, 7, 9, 8, 10, 11}
- },
- [F3] = {
- .corner = {38, 1, 36, 3, 64, 5, 66, 7},
- .edge = {24, 1, 2, 25, 4, 5, 6, 7, 19, 16, 10, 11}
- },
- [B] = {
- .corner = {0, 37, 2, 39, 4, 67, 6, 65},
- .edge = {0, 27, 26, 3, 4, 5, 6, 7, 8, 9, 17, 18}
- },
- [B2] = {
- .corner = {0, 3, 2, 1, 4, 7, 6, 5},
- .edge = {0, 2, 1, 3, 4, 5, 6, 7, 8, 9, 11, 10}
- },
- [B3] = {
- .corner = {0, 39, 2, 37, 4, 65, 6, 67},
- .edge = {0, 26, 27, 3, 4, 5, 6, 7, 8, 9, 18, 17}
- },
-};
-
-_static cube_t trans_table[][2] = {
- [UFr] = {
- [NORMAL] = {
- .corner = {0, 1, 2, 3, 4, 5, 6, 7},
- .edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
- },
- [INVERSE] = {
- .corner = {0, 1, 2, 3, 4, 5, 6, 7},
- .edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
- }
- },
- [ULr] = {
- [NORMAL] = {
- .corner = {4, 5, 7, 6, 1, 0, 2, 3},
- .edge = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24}
- },
- [INVERSE] = {
- .corner = {5, 4, 6, 7, 0, 1, 3, 2},
- .edge = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26}
- }
- },
- [UBr] = {
- [NORMAL] = {
- .corner = {1, 0, 3, 2, 5, 4, 7, 6},
- .edge = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9}
- },
- [INVERSE] = {
- .corner = {1, 0, 3, 2, 5, 4, 7, 6},
- .edge = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9}
- }
- },
- [URr] = {
- [NORMAL] = {
- .corner = {5, 4, 6, 7, 0, 1, 3, 2},
- .edge = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26}
- },
- [INVERSE] = {
- .corner = {4, 5, 7, 6, 1, 0, 2, 3},
- .edge = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24}
- }
- },
- [DFr] = {
- [NORMAL] = {
- .corner = {2, 3, 0, 1, 6, 7, 4, 5},
- .edge = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10}
- },
- [INVERSE] = {
- .corner = {2, 3, 0, 1, 6, 7, 4, 5},
- .edge = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10}
- }
- },
- [DLr] = {
- [NORMAL] = {
- .corner = {7, 6, 4, 5, 2, 3, 1, 0},
- .edge = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27}
- },
- [INVERSE] = {
- .corner = {7, 6, 4, 5, 2, 3, 1, 0},
- .edge = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27}
- }
- },
- [DBr] = {
- [NORMAL] = {
- .corner = {3, 2, 1, 0, 7, 6, 5, 4},
- .edge = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8}
- },
- [INVERSE] = {
- .corner = {3, 2, 1, 0, 7, 6, 5, 4},
- .edge = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8}
- }
- },
- [DRr] = {
- [NORMAL] = {
- .corner = {6, 7, 5, 4, 3, 2, 0, 1},
- .edge = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25}
- },
- [INVERSE] = {
- .corner = {6, 7, 5, 4, 3, 2, 0, 1},
- .edge = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25}
- }
- },
- [RUr] = {
- [NORMAL] = {
- .corner = {64, 67, 65, 66, 37, 38, 36, 39},
- .edge = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3}
- },
- [INVERSE] = {
- .corner = {32, 34, 35, 33, 70, 68, 69, 71},
- .edge = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21}
- }
- },
- [RFr] = {
- [NORMAL] = {
- .corner = {38, 37, 36, 39, 64, 67, 66, 65},
- .edge = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18}
- },
- [INVERSE] = {
- .corner = {36, 39, 38, 37, 66, 65, 64, 67},
- .edge = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17}
- }
- },
- [RDr] = {
- [NORMAL] = {
- .corner = {67, 64, 66, 65, 38, 37, 39, 36},
- .edge = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1}
- },
- [INVERSE] = {
- .corner = {33, 35, 34, 32, 71, 69, 68, 70},
- .edge = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20}
- }
- },
- [RBr] = {
- [NORMAL] = {
- .corner = {37, 38, 39, 36, 67, 64, 65, 66},
- .edge = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16}
- },
- [INVERSE] = {
- .corner = {37, 38, 39, 36, 67, 64, 65, 66},
- .edge = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16}
- }
- },
- [LUr] = {
- [NORMAL] = {
- .corner = {65, 66, 64, 67, 36, 39, 37, 38},
- .edge = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2}
- },
- [INVERSE] = {
- .corner = {34, 32, 33, 35, 68, 70, 71, 69},
- .edge = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23}
- }
- },
- [LFr] = {
- [NORMAL] = {
- .corner = {36, 39, 38, 37, 66, 65, 64, 67},
- .edge = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17}
- },
- [INVERSE] = {
- .corner = {38, 37, 36, 39, 64, 67, 66, 65},
- .edge = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18}
- }
- },
- [LDr] = {
- [NORMAL] = {
- .corner = {66, 65, 67, 64, 39, 36, 38, 37},
- .edge = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0}
- },
- [INVERSE] = {
- .corner = {35, 33, 32, 34, 69, 71, 70, 68},
- .edge = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22}
- }
- },
- [LBr] = {
- [NORMAL] = {
- .corner = {39, 36, 37, 38, 65, 66, 67, 64},
- .edge = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19}
- },
- [INVERSE] = {
- .corner = {39, 36, 37, 38, 65, 66, 67, 64},
- .edge = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19}
- }
- },
- [FUr] = {
- [NORMAL] = {
- .corner = {68, 70, 69, 71, 32, 34, 33, 35},
- .edge = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6}
- },
- [INVERSE] = {
- .corner = {68, 70, 69, 71, 32, 34, 33, 35},
- .edge = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6}
- }
- },
- [FRr] = {
- [NORMAL] = {
- .corner = {32, 34, 35, 33, 70, 68, 69, 71},
- .edge = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21}
- },
- [INVERSE] = {
- .corner = {64, 67, 65, 66, 37, 38, 36, 39},
- .edge = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3}
- }
- },
- [FDr] = {
- [NORMAL] = {
- .corner = {70, 68, 71, 69, 34, 32, 35, 33},
- .edge = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4}
- },
- [INVERSE] = {
- .corner = {69, 71, 68, 70, 33, 35, 32, 34},
- .edge = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7}
- }
- },
- [FLr] = {
- [NORMAL] = {
- .corner = {34, 32, 33, 35, 68, 70, 71, 69},
- .edge = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23}
- },
- [INVERSE] = {
- .corner = {65, 66, 64, 67, 36, 39, 37, 38},
- .edge = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2}
- }
- },
- [BUr] = {
- [NORMAL] = {
- .corner = {69, 71, 68, 70, 33, 35, 32, 34},
- .edge = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7}
- },
- [INVERSE] = {
- .corner = {70, 68, 71, 69, 34, 32, 35, 33},
- .edge = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4}
- }
- },
- [BRr] = {
- [NORMAL] = {
- .corner = {35, 33, 32, 34, 69, 71, 70, 68},
- .edge = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22}
- },
- [INVERSE] = {
- .corner = {66, 65, 67, 64, 39, 36, 38, 37},
- .edge = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0}
- }
- },
- [BDr] = {
- [NORMAL] = {
- .corner = {71, 69, 70, 68, 35, 33, 34, 32},
- .edge = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5}
- },
- [INVERSE] = {
- .corner = {71, 69, 70, 68, 35, 33, 34, 32},
- .edge = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5}
- }
- },
- [BLr] = {
- [NORMAL] = {
- .corner = {33, 35, 34, 32, 71, 69, 68, 70},
- .edge = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20}
- },
- [INVERSE] = {
- .corner = {67, 64, 66, 65, 38, 37, 39, 36},
- .edge = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1}
- }
- },
- [UFm] = {
- [NORMAL] = {
- .corner = {4, 5, 6, 7, 0, 1, 2, 3},
- .edge = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10}
- },
- [INVERSE] = {
- .corner = {4, 5, 6, 7, 0, 1, 2, 3},
- .edge = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10}
- }
- },
- [ULm] = {
- [NORMAL] = {
- .corner = {0, 1, 3, 2, 5, 4, 6, 7},
- .edge = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25}
- },
- [INVERSE] = {
- .corner = {0, 1, 3, 2, 5, 4, 6, 7},
- .edge = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25}
- }
- },
- [UBm] = {
- [NORMAL] = {
- .corner = {5, 4, 7, 6, 1, 0, 3, 2},
- .edge = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8}
- },
- [INVERSE] = {
- .corner = {5, 4, 7, 6, 1, 0, 3, 2},
- .edge = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8}
- }
- },
- [URm] = {
- [NORMAL] = {
- .corner = {1, 0, 2, 3, 4, 5, 7, 6},
- .edge = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27}
- },
- [INVERSE] = {
- .corner = {1, 0, 2, 3, 4, 5, 7, 6},
- .edge = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27}
- }
- },
- [DFm] = {
- [NORMAL] = {
- .corner = {6, 7, 4, 5, 2, 3, 0, 1},
- .edge = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11}
- },
- [INVERSE] = {
- .corner = {6, 7, 4, 5, 2, 3, 0, 1},
- .edge = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11}
- }
- },
- [DLm] = {
- [NORMAL] = {
- .corner = {3, 2, 0, 1, 6, 7, 5, 4},
- .edge = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26}
- },
- [INVERSE] = {
- .corner = {2, 3, 1, 0, 7, 6, 4, 5},
- .edge = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24}
- }
- },
- [DBm] = {
- [NORMAL] = {
- .corner = {7, 6, 5, 4, 3, 2, 1, 0},
- .edge = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9}
- },
- [INVERSE] = {
- .corner = {7, 6, 5, 4, 3, 2, 1, 0},
- .edge = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9}
- }
- },
- [DRm] = {
- [NORMAL] = {
- .corner = {2, 3, 1, 0, 7, 6, 4, 5},
- .edge = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24}
- },
- [INVERSE] = {
- .corner = {3, 2, 0, 1, 6, 7, 5, 4},
- .edge = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26}
- }
- },
- [RUm] = {
- [NORMAL] = {
- .corner = {68, 71, 69, 70, 33, 34, 32, 35},
- .edge = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3}
- },
- [INVERSE] = {
- .corner = {70, 68, 69, 71, 32, 34, 35, 33},
- .edge = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22}
- }
- },
- [RFm] = {
- [NORMAL] = {
- .corner = {34, 33, 32, 35, 68, 71, 70, 69},
- .edge = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18}
- },
- [INVERSE] = {
- .corner = {66, 65, 64, 67, 36, 39, 38, 37},
- .edge = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18}
- }
- },
- [RDm] = {
- [NORMAL] = {
- .corner = {71, 68, 70, 69, 34, 33, 35, 32},
- .edge = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1}
- },
- [INVERSE] = {
- .corner = {71, 69, 68, 70, 33, 35, 34, 32},
- .edge = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23}
- }
- },
- [RBm] = {
- [NORMAL] = {
- .corner = {33, 34, 35, 32, 71, 68, 69, 70},
- .edge = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16}
- },
- [INVERSE] = {
- .corner = {67, 64, 65, 66, 37, 38, 39, 36},
- .edge = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19}
- }
- },
- [LUm] = {
- [NORMAL] = {
- .corner = {69, 70, 68, 71, 32, 35, 33, 34},
- .edge = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2}
- },
- [INVERSE] = {
- .corner = {68, 70, 71, 69, 34, 32, 33, 35},
- .edge = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20}
- }
- },
- [LFm] = {
- [NORMAL] = {
- .corner = {32, 35, 34, 33, 70, 69, 68, 71},
- .edge = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17}
- },
- [INVERSE] = {
- .corner = {64, 67, 66, 65, 38, 37, 36, 39},
- .edge = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17}
- }
- },
- [LDm] = {
- [NORMAL] = {
- .corner = {70, 69, 71, 68, 35, 32, 34, 33},
- .edge = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0}
- },
- [INVERSE] = {
- .corner = {69, 71, 70, 68, 35, 33, 32, 34},
- .edge = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21}
- }
- },
- [LBm] = {
- [NORMAL] = {
- .corner = {35, 32, 33, 34, 69, 70, 71, 68},
- .edge = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19}
- },
- [INVERSE] = {
- .corner = {65, 66, 67, 64, 39, 36, 37, 38},
- .edge = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16}
- }
- },
- [FUm] = {
- [NORMAL] = {
- .corner = {64, 66, 65, 67, 36, 38, 37, 39},
- .edge = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7}
- },
- [INVERSE] = {
- .corner = {32, 34, 33, 35, 68, 70, 69, 71},
- .edge = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7}
- }
- },
- [FRm] = {
- [NORMAL] = {
- .corner = {36, 38, 39, 37, 66, 64, 65, 67},
- .edge = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20}
- },
- [INVERSE] = {
- .corner = {37, 38, 36, 39, 64, 67, 65, 66},
- .edge = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2}
- }
- },
- [FDm] = {
- [NORMAL] = {
- .corner = {66, 64, 67, 65, 38, 36, 39, 37},
- .edge = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5}
- },
- [INVERSE] = {
- .corner = {33, 35, 32, 34, 69, 71, 68, 70},
- .edge = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6}
- }
- },
- [FLm] = {
- [NORMAL] = {
- .corner = {38, 36, 37, 39, 64, 66, 67, 65},
- .edge = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22}
- },
- [INVERSE] = {
- .corner = {36, 39, 37, 38, 65, 66, 64, 67},
- .edge = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3}
- }
- },
- [BUm] = {
- [NORMAL] = {
- .corner = {65, 67, 64, 66, 37, 39, 36, 38},
- .edge = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6}
- },
- [INVERSE] = {
- .corner = {34, 32, 35, 33, 70, 68, 71, 69},
- .edge = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5}
- }
- },
- [BRm] = {
- [NORMAL] = {
- .corner = {39, 37, 36, 38, 65, 67, 66, 64},
- .edge = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23}
- },
- [INVERSE] = {
- .corner = {39, 36, 38, 37, 66, 65, 67, 64},
- .edge = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1}
- }
- },
- [BDm] = {
- [NORMAL] = {
- .corner = {67, 65, 66, 64, 39, 37, 38, 36},
- .edge = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4}
- },
- [INVERSE] = {
- .corner = {35, 33, 34, 32, 71, 69, 70, 68},
- .edge = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4}
- }
- },
- [BLm] = {
- [NORMAL] = {
- .corner = {37, 39, 38, 36, 67, 65, 64, 66},
- .edge = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21}
- },
- [INVERSE] = {
- .corner = {38, 37, 39, 36, 67, 64, 66, 65},
- .edge = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0}
- }
- },
-};
-
-_static char *cornerstr[] = {
- [_c_ufr] = "UFR",
- [_c_ubl] = "UBL",
- [_c_dfl] = "DFL",
- [_c_dbr] = "DBR",
- [_c_ufl] = "UFL",
- [_c_ubr] = "UBR",
- [_c_dfr] = "DFR",
- [_c_dbl] = "DBL"
-};
-
-_static char *cornerstralt[] = {
- [_c_ufr] = "URF",
- [_c_ubl] = "ULB",
- [_c_dfl] = "DLF",
- [_c_dbr] = "DRB",
- [_c_ufl] = "ULF",
- [_c_ubr] = "URB",
- [_c_dfr] = "DRF",
- [_c_dbl] = "DLB"
-};
-
-_static char *edgestr[] = {
- [_e_uf] = "UF",
- [_e_ub] = "UB",
- [_e_db] = "DB",
- [_e_df] = "DF",
- [_e_ur] = "UR",
- [_e_ul] = "UL",
- [_e_dl] = "DL",
- [_e_dr] = "DR",
- [_e_fr] = "FR",
- [_e_fl] = "FL",
- [_e_bl] = "BL",
- [_e_br] = "BR"
-};
-
-_static char *movestr[] = {
- [U] = "U",
- [U2] = "U2",
- [U3] = "U'",
- [D] = "D",
- [D2] = "D2",
- [D3] = "D'",
- [R] = "R",
- [R2] = "R2",
- [R3] = "R'",
- [L] = "L",
- [L2] = "L2",
- [L3] = "L'",
- [F] = "F",
- [F2] = "F2",
- [F3] = "F'",
- [B] = "B",
- [B2] = "B2",
- [B3] = "B'",
-};
-
-_static char *transstr[] = {
- [UFr] = "rotation UF",
- [UFm] = "mirrored UF",
- [ULr] = "rotation UL",
- [ULm] = "mirrored UL",
- [UBr] = "rotation UB",
- [UBm] = "mirrored UB",
- [URr] = "rotation UR",
- [URm] = "mirrored UR",
- [DFr] = "rotation DF",
- [DFm] = "mirrored DF",
- [DLr] = "rotation DL",
- [DLm] = "mirrored DL",
- [DBr] = "rotation DB",
- [DBm] = "mirrored DB",
- [DRr] = "rotation DR",
- [DRm] = "mirrored DR",
- [RUr] = "rotation RU",
- [RUm] = "mirrored RU",
- [RFr] = "rotation RF",
- [RFm] = "mirrored RF",
- [RDr] = "rotation RD",
- [RDm] = "mirrored RD",
- [RBr] = "rotation RB",
- [RBm] = "mirrored RB",
- [LUr] = "rotation LU",
- [LUm] = "mirrored LU",
- [LFr] = "rotation LF",
- [LFm] = "mirrored LF",
- [LDr] = "rotation LD",
- [LDm] = "mirrored LD",
- [LBr] = "rotation LB",
- [LBm] = "mirrored LB",
- [FUr] = "rotation FU",
- [FUm] = "mirrored FU",
- [FRr] = "rotation FR",
- [FRm] = "mirrored FR",
- [FDr] = "rotation FD",
- [FDm] = "mirrored FD",
- [FLr] = "rotation FL",
- [FLm] = "mirrored FL",
- [BUr] = "rotation BU",
- [BUm] = "mirrored BU",
- [BRr] = "rotation BR",
- [BRm] = "mirrored BR",
- [BDr] = "rotation BD",
- [BDm] = "mirrored BD",
- [BLr] = "rotation BL",
- [BLm] = "mirrored BL",
-};
-
-static uint8_t inverse_trans_table[48] = {
- [UFr] = UFr,
- [UFm] = UFm,
- [ULr] = URr,
- [ULm] = ULm,
- [UBr] = UBr,
- [UBm] = UBm,
- [URr] = ULr,
- [URm] = URm,
- [DFr] = DFr,
- [DFm] = DFm,
- [DLr] = DLr,
- [DLm] = DRm,
- [DBr] = DBr,
- [DBm] = DBm,
- [DRr] = DRr,
- [DRm] = DLm,
- [RUr] = FRr,
- [RUm] = FLm,
- [RFr] = LFr,
- [RFm] = RFm,
- [RDr] = BLr,
- [RDm] = BRm,
- [RBr] = RBr,
- [RBm] = LBm,
- [LUr] = FLr,
- [LUm] = FRm,
- [LFr] = RFr,
- [LFm] = LFm,
- [LDr] = BRr,
- [LDm] = BLm,
- [LBr] = LBr,
- [LBm] = RBm,
- [FUr] = FUr,
- [FUm] = FUm,
- [FRr] = RUr,
- [FRm] = LUm,
- [FDr] = BUr,
- [FDm] = BUm,
- [FLr] = LUr,
- [FLm] = RUm,
- [BUr] = FDr,
- [BUm] = FDm,
- [BRr] = LDr,
- [BRm] = RDm,
- [BDr] = BDr,
- [BDm] = BDm,
- [BLr] = RDr,
- [BLm] = LDm,
-};
diff --git a/test/001_cube_conversion/00_solved.in b/test/001_cube_conversion/00_solved.in
@@ -1 +0,0 @@
-UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/001_cube_conversion/00_solved.out b/test/001_cube_conversion/00_solved.out
@@ -1 +0,0 @@
-UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
diff --git a/test/001_cube_conversion/01_scrambled.in b/test/001_cube_conversion/01_scrambled.in
@@ -1 +0,0 @@
-BL1 DB0 UL1 DF0 BR1 UF1 DL0 FL1 UB0 DR1 FR1 UR1 UBR2 UBL1 DFR2 DBL2 DBR0 DFL0 UFR0 UFL2
diff --git a/test/001_cube_conversion/01_scrambled.out b/test/001_cube_conversion/01_scrambled.out
@@ -1 +0,0 @@
-BL1 DB0 UL1 DF0 BR1 UF1 DL0 FL1 UB0 DR1 FR1 UR1 UBR2 UBL1 DFR2 DBL2 DBR0 DFL0 UFR0 UFL2
diff --git a/test/001_cube_conversion/cube_conversion_tests.c b/test/001_cube_conversion/cube_conversion_tests.c
@@ -1,27 +0,0 @@
-#include "../test.h"
-
-cube_fast_t cubetofast(cube_t);
-cube_t fasttocube(cube_fast_t);
-bool equal(cube_t, cube_t);
-
-int main(void) {
- char cubestr[STRLENMAX];
- cube_t cube, cube2;
- cube_fast_t fast;
-
- fgets(cubestr, STRLENMAX, stdin);
- cube = readcube("H48", cubestr);
- fast = cubetofast(cube);
- cube2 = fasttocube(fast);
-
- if (cube_error(cube)) {
- printf("Error reading cube\n");
- } else if (cube_error(cube2)) {
- printf("Error converting cube\n");
- } else {
- writecube("H48", cube2, cubestr);
- printf("%s\n", cubestr);
- }
-
- return 0;
-}
diff --git a/test/050_compose/compose_tests.c b/test/050_compose/compose_tests.c
@@ -1,7 +1,5 @@
#include "../test.h"
-cube_t compose(cube_t, cube_t);
-
int main(void) {
char str[STRLENMAX];
cube_t c1, c2, c3;
@@ -11,7 +9,7 @@ int main(void) {
fgets(str, STRLENMAX, stdin);
c2 = readcube("H48", str);
- c3 = compose(c1, c2);
+ c3 = cube_compose(c1, c2);
if (cube_error(c3)) {
printf("Error composing cubes\n");
diff --git a/test/071_coord_eo/coord_eo_tests.c b/test/071_coord_eo/coord_eo_tests.c
@@ -1,19 +1,14 @@
#include "../test.h"
-int64_t coord_fast_eo(cube_fast_t);
-cube_fast_t cubetofast(cube_t);
-
int main(void) {
char str[STRLENMAX];
cube_t cube;
- cube_fast_t fast;
int64_t result;
fgets(str, STRLENMAX, stdin);
cube = readcube("H48", str);
- fast = cubetofast(cube);
- result = coord_fast_eo(fast);
+ result = cube_coord_eo(cube);
printf("%" PRId64 "\n", result);
diff --git a/test/072_coord_co/coord_co_tests.c b/test/072_coord_co/coord_co_tests.c
@@ -1,19 +1,14 @@
#include "../test.h"
-int64_t coord_fast_co(cube_fast_t);
-cube_fast_t cubetofast(cube_t);
-
int main(void) {
char str[STRLENMAX];
cube_t cube;
- cube_fast_t fast;
int64_t result;
fgets(str, STRLENMAX, stdin);
cube = readcube("H48", str);
- fast = cubetofast(cube);
- result = coord_fast_co(fast);
+ result = cube_coord_co(cube);
printf("%" PRId64 "\n", result);
diff --git a/test/last.err b/test/last.err
diff --git a/test/last.out b/test/last.out
@@ -1 +0,0 @@
-UL1 UB0 DL1 UR0 BL1 DR1 BR0 DB0 FL1 UF0 FR1 DF0 DFR2 DFL0 DBL0 UFL0 UBR1 UBL0 UFR2 DBR1