From 0b1930307f41db3ea7552d6b2f4666b33c64d26a Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 9 Jun 2024 20:06:19 +0200 Subject: More cleanup --- old/_trans_move_arr.c | 389 ------------------------------------- old/gendata_bfs_attempt.c | 153 --------------- old/inverse_fast.c | 51 ----- old/inverses.c | 71 ------- old/moves_trans/genmovecode.sh | 19 -- old/moves_trans/gentranscode.sh | 42 ---- old/moves_trans/moves_src.c | 264 ------------------------- old/moves_trans/v2/genmovecode.sh | 21 -- old/moves_trans/v2/gentranscode.sh | 24 --- 9 files changed, 1034 deletions(-) delete mode 100644 old/_trans_move_arr.c delete mode 100644 old/gendata_bfs_attempt.c delete mode 100644 old/inverse_fast.c delete mode 100644 old/inverses.c delete mode 100755 old/moves_trans/genmovecode.sh delete mode 100755 old/moves_trans/gentranscode.sh delete mode 100644 old/moves_trans/moves_src.c delete mode 100755 old/moves_trans/v2/genmovecode.sh delete mode 100755 old/moves_trans/v2/gentranscode.sh (limited to 'old') diff --git a/old/_trans_move_arr.c b/old/_trans_move_arr.c deleted file mode 100644 index a00105f..0000000 --- a/old/_trans_move_arr.c +++ /dev/null @@ -1,389 +0,0 @@ -static cube_t trans_move_cube[] = { - [UFr] = { - .c = {0, 1, 2, 3, 4, 5, 6, 7}, - .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} - }, - [ULr] = { - .c = {4, 5, 7, 6, 1, 0, 2, 3}, - .e = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24} - }, - [UBr] = { - .c = {1, 0, 3, 2, 5, 4, 7, 6}, - .e = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9} - }, - [URr] = { - .c = {5, 4, 6, 7, 0, 1, 3, 2}, - .e = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26} - }, - [DFr] = { - .c = {2, 3, 0, 1, 6, 7, 4, 5}, - .e = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10} - }, - [DLr] = { - .c = {7, 6, 4, 5, 2, 3, 1, 0}, - .e = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27} - }, - [DBr] = { - .c = {3, 2, 1, 0, 7, 6, 5, 4}, - .e = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8} - }, - [DRr] = { - .c = {6, 7, 5, 4, 3, 2, 0, 1}, - .e = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25} - }, - [RUr] = { - .c = {64, 67, 65, 66, 37, 38, 36, 39}, - .e = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3} - }, - [RFr] = { - .c = {38, 37, 36, 39, 64, 67, 66, 65}, - .e = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18} - }, - [RDr] = { - .c = {67, 64, 66, 65, 38, 37, 39, 36}, - .e = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1} - }, - [RBr] = { - .c = {37, 38, 39, 36, 67, 64, 65, 66}, - .e = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16} - }, - [LUr] = { - .c = {65, 66, 64, 67, 36, 39, 37, 38}, - .e = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2} - }, - [LFr] = { - .c = {36, 39, 38, 37, 66, 65, 64, 67}, - .e = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17} - }, - [LDr] = { - .c = {66, 65, 67, 64, 39, 36, 38, 37}, - .e = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0} - }, - [LBr] = { - .c = {39, 36, 37, 38, 65, 66, 67, 64}, - .e = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19} - }, - [FUr] = { - .c = {68, 70, 69, 71, 32, 34, 33, 35}, - .e = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6} - }, - [FRr] = { - .c = {32, 34, 35, 33, 70, 68, 69, 71}, - .e = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21} - }, - [FDr] = { - .c = {70, 68, 71, 69, 34, 32, 35, 33}, - .e = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4} - }, - [FLr] = { - .c = {34, 32, 33, 35, 68, 70, 71, 69}, - .e = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23} - }, - [BUr] = { - .c = {69, 71, 68, 70, 33, 35, 32, 34}, - .e = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7} - }, - [BRr] = { - .c = {35, 33, 32, 34, 69, 71, 70, 68}, - .e = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22} - }, - [BDr] = { - .c = {71, 69, 70, 68, 35, 33, 34, 32}, - .e = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5} - }, - [BLr] = { - .c = {33, 35, 34, 32, 71, 69, 68, 70}, - .e = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20} - }, - [UFm] = { - .c = {4, 5, 6, 7, 0, 1, 2, 3}, - .e = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10} - }, - [ULm] = { - .c = {0, 1, 3, 2, 5, 4, 6, 7}, - .e = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25} - }, - [UBm] = { - .c = {5, 4, 7, 6, 1, 0, 3, 2}, - .e = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8} - }, - [URm] = { - .c = {1, 0, 2, 3, 4, 5, 7, 6}, - .e = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27} - }, - [DFm] = { - .c = {6, 7, 4, 5, 2, 3, 0, 1}, - .e = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11} - }, - [DLm] = { - .c = {3, 2, 0, 1, 6, 7, 5, 4}, - .e = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26} - }, - [DBm] = { - .c = {7, 6, 5, 4, 3, 2, 1, 0}, - .e = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9} - }, - [DRm] = { - .c = {2, 3, 1, 0, 7, 6, 4, 5}, - .e = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24} - }, - [RUm] = { - .c = {68, 71, 69, 70, 33, 34, 32, 35}, - .e = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3} - }, - [RFm] = { - .c = {34, 33, 32, 35, 68, 71, 70, 69}, - .e = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18} - }, - [RDm] = { - .c = {71, 68, 70, 69, 34, 33, 35, 32}, - .e = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1} - }, - [RBm] = { - .c = {33, 34, 35, 32, 71, 68, 69, 70}, - .e = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16} - }, - [LUm] = { - .c = {69, 70, 68, 71, 32, 35, 33, 34}, - .e = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2} - }, - [LFm] = { - .c = {32, 35, 34, 33, 70, 69, 68, 71}, - .e = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17} - }, - [LDm] = { - .c = {70, 69, 71, 68, 35, 32, 34, 33}, - .e = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0} - }, - [LBm] = { - .c = {35, 32, 33, 34, 69, 70, 71, 68}, - .e = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19} - }, - [FUm] = { - .c = {64, 66, 65, 67, 36, 38, 37, 39}, - .e = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7} - }, - [FRm] = { - .c = {36, 38, 39, 37, 66, 64, 65, 67}, - .e = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20} - }, - [FDm] = { - .c = {66, 64, 67, 65, 38, 36, 39, 37}, - .e = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5} - }, - [FLm] = { - .c = {38, 36, 37, 39, 64, 66, 67, 65}, - .e = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22} - }, - [BUm] = { - .c = {65, 67, 64, 66, 37, 39, 36, 38}, - .e = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6} - }, - [BRm] = { - .c = {39, 37, 36, 38, 65, 67, 66, 64}, - .e = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23} - }, - [BDm] = { - .c = {67, 65, 66, 64, 39, 37, 38, 36}, - .e = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4} - }, - [BLm] = { - .c = {37, 39, 38, 36, 67, 65, 64, 66}, - .e = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21} - }, -}; - -static cube_t trans_move_cube_inverse[] = { - [UFr] = { - .c = {0, 1, 2, 3, 4, 5, 6, 7}, - .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} - }, - [ULr] = { - .c = {5, 4, 6, 7, 0, 1, 3, 2}, - .e = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26} - }, - [UBr] = { - .c = {1, 0, 3, 2, 5, 4, 7, 6}, - .e = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9} - }, - [URr] = { - .c = {4, 5, 7, 6, 1, 0, 2, 3}, - .e = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24} - }, - [DFr] = { - .c = {2, 3, 0, 1, 6, 7, 4, 5}, - .e = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10} - }, - [DLr] = { - .c = {7, 6, 4, 5, 2, 3, 1, 0}, - .e = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27} - }, - [DBr] = { - .c = {3, 2, 1, 0, 7, 6, 5, 4}, - .e = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8} - }, - [DRr] = { - .c = {6, 7, 5, 4, 3, 2, 0, 1}, - .e = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25} - }, - [RUr] = { - .c = {32, 34, 35, 33, 70, 68, 69, 71}, - .e = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21} - }, - [RFr] = { - .c = {36, 39, 38, 37, 66, 65, 64, 67}, - .e = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17} - }, - [RDr] = { - .c = {33, 35, 34, 32, 71, 69, 68, 70}, - .e = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20} - }, - [RBr] = { - .c = {37, 38, 39, 36, 67, 64, 65, 66}, - .e = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16} - }, - [LUr] = { - .c = {34, 32, 33, 35, 68, 70, 71, 69}, - .e = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23} - }, - [LFr] = { - .c = {38, 37, 36, 39, 64, 67, 66, 65}, - .e = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18} - }, - [LDr] = { - .c = {35, 33, 32, 34, 69, 71, 70, 68}, - .e = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22} - }, - [LBr] = { - .c = {39, 36, 37, 38, 65, 66, 67, 64}, - .e = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19} - }, - [FUr] = { - .c = {68, 70, 69, 71, 32, 34, 33, 35}, - .e = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6} - }, - [FRr] = { - .c = {64, 67, 65, 66, 37, 38, 36, 39}, - .e = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3} - }, - [FDr] = { - .c = {69, 71, 68, 70, 33, 35, 32, 34}, - .e = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7} - }, - [FLr] = { - .c = {65, 66, 64, 67, 36, 39, 37, 38}, - .e = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2} - }, - [BUr] = { - .c = {70, 68, 71, 69, 34, 32, 35, 33}, - .e = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4} - }, - [BRr] = { - .c = {66, 65, 67, 64, 39, 36, 38, 37}, - .e = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0} - }, - [BDr] = { - .c = {71, 69, 70, 68, 35, 33, 34, 32}, - .e = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5} - }, - [BLr] = { - .c = {67, 64, 66, 65, 38, 37, 39, 36}, - .e = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1} - }, - [UFm] = { - .c = {4, 5, 6, 7, 0, 1, 2, 3}, - .e = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10} - }, - [ULm] = { - .c = {0, 1, 3, 2, 5, 4, 6, 7}, - .e = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25} - }, - [UBm] = { - .c = {5, 4, 7, 6, 1, 0, 3, 2}, - .e = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8} - }, - [URm] = { - .c = {1, 0, 2, 3, 4, 5, 7, 6}, - .e = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27} - }, - [DFm] = { - .c = {6, 7, 4, 5, 2, 3, 0, 1}, - .e = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11} - }, - [DLm] = { - .c = {2, 3, 1, 0, 7, 6, 4, 5}, - .e = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24} - }, - [DBm] = { - .c = {7, 6, 5, 4, 3, 2, 1, 0}, - .e = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9} - }, - [DRm] = { - .c = {3, 2, 0, 1, 6, 7, 5, 4}, - .e = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26} - }, - [RUm] = { - .c = {70, 68, 69, 71, 32, 34, 35, 33}, - .e = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22} - }, - [RFm] = { - .c = {66, 65, 64, 67, 36, 39, 38, 37}, - .e = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18} - }, - [RDm] = { - .c = {71, 69, 68, 70, 33, 35, 34, 32}, - .e = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23} - }, - [RBm] = { - .c = {67, 64, 65, 66, 37, 38, 39, 36}, - .e = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19} - }, - [LUm] = { - .c = {68, 70, 71, 69, 34, 32, 33, 35}, - .e = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20} - }, - [LFm] = { - .c = {64, 67, 66, 65, 38, 37, 36, 39}, - .e = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17} - }, - [LDm] = { - .c = {69, 71, 70, 68, 35, 33, 32, 34}, - .e = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21} - }, - [LBm] = { - .c = {65, 66, 67, 64, 39, 36, 37, 38}, - .e = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16} - }, - [FUm] = { - .c = {32, 34, 33, 35, 68, 70, 69, 71}, - .e = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7} - }, - [FRm] = { - .c = {37, 38, 36, 39, 64, 67, 65, 66}, - .e = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2} - }, - [FDm] = { - .c = {33, 35, 32, 34, 69, 71, 68, 70}, - .e = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6} - }, - [FLm] = { - .c = {36, 39, 37, 38, 65, 66, 64, 67}, - .e = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3} - }, - [BUm] = { - .c = {34, 32, 35, 33, 70, 68, 71, 69}, - .e = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5} - }, - [BRm] = { - .c = {39, 36, 38, 37, 66, 65, 67, 64}, - .e = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1} - }, - [BDm] = { - .c = {35, 33, 34, 32, 71, 69, 70, 68}, - .e = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4} - }, - [BLm] = { - .c = {38, 37, 39, 36, 67, 64, 66, 65}, - .e = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0} - }, -}; diff --git a/old/gendata_bfs_attempt.c b/old/gendata_bfs_attempt.c deleted file mode 100644 index 4cd5ae9..0000000 --- a/old/gendata_bfs_attempt.c +++ /dev/null @@ -1,153 +0,0 @@ -_static size_t gendata_cocsep(void *); -_static uint32_t dfs_cocsep(cube_fast_t, uint8_t, uint8_t, uint32_t *); - -/* -Each element of the cocsep table is a uint32_t used as follows: - - Lowest 8-bit block: pruning value - - Second-lower 8-bit block: "ttrep" (transformation to representative) - - Top 16-bit block: symcoord value -After the data as described above, more auxiliary information is appended: - - A uint32_t representing the number of symmetry classes - - A uint32_t representing the highest value of the pruning table - - One uint32_t for each "line" of the pruning table, representing the number - of positions having that pruning value. -*/ -_static size_t -gendata_cocsep(void *buf) -{ - uint32_t *buf32, cc; - uint64_t i64; - uint16_t n; - uint8_t i, j; - size_t tablesize; - - tablesize = _3p7 << 7U; - - buf32 = (uint32_t *)buf; - memset(buf32, 0xFFU, 4*tablesize); - memset(buf32 + tablesize, 0, 21*4); - -/* New impl BFS - - uint32_t nold = 0, nnew = 0; - uint64_t coord; - uint8_t m, olddepth; - cube_fast_t c, d, oldlevel[100000], newlevel[100000]; - newlevel[0] = cubetofast(solvedcube()); - nnew = 1; - buf32[coord_fast_cocsep(newlevel[0])] = UFr << 8U; - n = 1; - DBG_LOG("gendata_cocsep: found 1 position at depth 0\n"); - for (i = 1; i < 10; i++) { - DBG_LOG("gendata_cocsep: generating depth %" PRIu8 "\n", i); - memcpy(oldlevel, newlevel, nnew * sizeof(cube_fast_t)); - nold = nnew; - nnew = 0; - for (j = 0; j < nold; j++) { - _foreach_move(m, oldlevel[j], newlevel[nnew], - coord = coord_fast_cocsep(newlevel[nnew]); - olddepth = buf32[coord] & 0xFFU; - buf32[coord] = i; - nnew += olddepth > i; - ) - } - DBG_LOG("found %" PRIu32 "\n", nnew); - } - -End new impl BFS */ - - /* Pruning values */ - buf32[tablesize+1] = 9U; /* Known max pruning value */ - for (i = 0, cc = 0; i < 10; i++) { - DBG_LOG("gendata_cocsep: generating depth %" PRIu8 "\n", i); - cc = dfs_cocsep(cubetofast(solvedcube()), 0, i, buf32); - buf32[tablesize+i+2] = cc; - DBG_LOG("found %" PRIu32 "\n", cc); - } - - /* Symmetries */ - for (i64 = 0, n = 0; i64 < tablesize; i64++) { - } - buf32[tablesize] = (uint32_t)n; - - DBG_LOG("cocsep data computed, %" PRIu32 " symmetry classes\n", n); - DBG_LOG("Maximum pruning value: %" PRIu32 "\n", buf32[tablesize+1]); - DBG_LOG("Pruning value distribution:\n"); - for (j = 0; j < 10; j++) - DBG_LOG("%" PRIu8 ":\t%" PRIu32 "\n", j, buf32[tablesize+j+2]); - - return 4*(tablesize + 11); -} - -_static uint32_t -dfs_cocsep(cube_fast_t c, uint8_t depth, uint8_t maxdepth, uint32_t *buf32) -{ - uint8_t m, olddepth; - uint32_t update, cc; - uint64_t i; - cube_fast_t d; - - i = coord_fast_cocsep(c); - olddepth = (uint8_t)(buf32[i] & 0xFFU); - if (olddepth < depth) - return 0; - - if (depth == maxdepth) { - update = (buf32[i] & 0xFFU) == 0xFFU; - buf32[i] = depth; - return update; - } - - cc = 0; - _foreach_move(m, c, d, - cc += dfs_cocsep(d, depth+1, maxdepth, buf32); - ) - - return cc; -} - -/* -_static uint32_t -dfs_cocsep( - cube_fast_t c, - uint8_t depth, - uint8_t maxdepth, - uint16_t *n, - uint32_t *buf32 -) -{ - uint8_t m, t, tinv, olddepth; - uint32_t cc, oldvalue; - uint64_t i; - cube_fast_t d; - - oldvalue = buf32[coord_fast_cocsep(c)]; - if (depth == maxdepth) { - if ((oldvalue & 0xFFU) != 0xFFU) - return 0; - - for (t = 0, cc = 0; t < 48; t++) { - d = transform(c, t); - i = coord_fast_cocsep(d); - tinv = inverse_trans(t); - if ((buf32[i] & 0xFFU) == 0xFFU) - cc++; - buf32[i] = (*n << 16U) | (tinv << 8U) | depth; - } - (*n)++; - - return cc; - } - - olddepth = (uint8_t)(oldvalue & 0xFFU); - if (olddepth != depth) - return 0; - - cc = 0; - _foreach_move(m, c, d, - cc += dfs_cocsep(d, depth+1, maxdepth, n, buf32); - ) - - return cc; -} -*/ diff --git a/old/inverse_fast.c b/old/inverse_fast.c deleted file mode 100644 index 13ace58..0000000 --- a/old/inverse_fast.c +++ /dev/null @@ -1,51 +0,0 @@ -_static_inline cube_fast_t -cleanaftershuffle(cube_fast_t c) -{ - __m256i b; - - b = _mm256_set_epi8( - ~0, ~0, ~0, ~0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - ~0, ~0, ~0, ~0, ~0, ~0, ~0, ~0, 0, 0, 0, 0, 0, 0, 0, 0 - ); - - return _mm256_andnot_si256(b, c); -} - -_static_inline cube_fast_t -inverse_fast(cube_fast_t c) -{ - /* Method taken from Andrew Skalski's vcube[1]. The addition sequence - * was generated using [2]. - * [1] https://github.com/Voltara/vcube - * [2] http://wwwhomes.uni-bielefeld.de/achim/addition_chain.html - */ - cube_fast_t v3, vi, vo, vp, ret; - - v3 = _mm256_shuffle_epi8(c, c); - v3 = _mm256_shuffle_epi8(v3, c); - vi = _mm256_shuffle_epi8(v3, v3); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, v3); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, c); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, v3); - vi = _mm256_shuffle_epi8(vi, vi); - vi = _mm256_shuffle_epi8(vi, c); - - vo = _mm256_and_si256(c, _mm256_or_si256(_eo_avx2, _co2_avx2)); - vo = _mm256_shuffle_epi8(vo, vi); - vp = _mm256_andnot_si256(_mm256_or_si256(_eo_avx2, _co2_avx2), vi); - ret = _mm256_or_si256(vp, vo); - ret = cleanaftershuffle(ret); - - return invertco_fast(ret); -} diff --git a/old/inverses.c b/old/inverses.c deleted file mode 100644 index eb8e80b..0000000 --- a/old/inverses.c +++ /dev/null @@ -1,71 +0,0 @@ -static move_t inverse_move_arr[] = { - [U] = U3, - [U2] = U2, - [U3] = U, - [D] = D3, - [D2] = D2, - [D3] = D, - [R] = R3, - [R2] = R2, - [R3] = R, - [L] = L3, - [L2] = L2, - [L3] = L, - [F] = F3, - [F2] = F2, - [F3] = F, - [B] = B3, - [B2] = B2, - [B3] = B, -}; - -static trans_t inverse_trans_arr[] = { - [UFr] = UFr, - [ULr] = URr, - [UBr] = UBr, - [URr] = URr, - [DFr] = DFr, - [DLr] = DLr, - [DRr] = DRr, - [DBr] = DBr, - [RUr] = FRr, - [RFr] = LFr, - [RDr] = BLr, - [RBr] = RBr, - [LUr] = FLr, - [LFr] = RFr, - [LDr] = BRr, - [LBr] = LBr, - [FUr] = FUr, - [FRr] = RUr, - [FDr] = BUr, - [FLr] = LUr, - [BUr] = FDr, - [BLr] = RDr, - [BDr] = BDr, - [BRr] = LDr, - [UFm] = UFm, - [ULm] = ULm, - [UBm] = UBm, - [URm] = ULm, - [DFm] = DFm, - [DLm] = DRm, - [DRm] = DLm, - [DBm] = DBm, - [RUm] = FLm, - [RFm] = RFm, - [RDm] = BRm, - [RBm] = LBm, - [LUm] = FRm, - [LFm] = LFm, - [LDm] = BLm, - [LBm] = RBm, - [FUm] = FUm, - [FRm] = LUm, - [FDm] = BUm, - [FLm] = RUm, - [BUm] = FDm, - [BLm] = LDm, - [BDm] = BDm, - [BRm] = RDm, -}; diff --git a/old/moves_trans/genmovecode.sh b/old/moves_trans/genmovecode.sh deleted file mode 100755 index 0857f31..0000000 --- a/old/moves_trans/genmovecode.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -type="${1:-src}" - -gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type" - -genfuncs() { - for f in move_??_*.txt; do - move="$(echo $f | sed 's/.*_// ; s/\.txt//')" - printf 'static inline cube_fast_t\n_move_%s' "$move" - printf '(cube_fast_t c)\n{\n' - printf '\tcube_fast_t m = ' - ./h48_to_"$type" <"$f" | sed '2,4s/^/\t/' - printf ';\n\n\treturn compose_fast(c, m);\n}\n\n' - done -} - -genfuncs -rm -f h48_to_"$type" invert diff --git a/old/moves_trans/gentranscode.sh b/old/moves_trans/gentranscode.sh deleted file mode 100755 index 198ac93..0000000 --- a/old/moves_trans/gentranscode.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -type="${1:-src}" - -gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type" -gcc -DDEBUG invert.c ../cube.c -o invert - -# Old version -genarray() { - for f in transform_??_???.txt; do - trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" - printf '[%s] = ' "$trans" - if [ "$1" = "-i" ]; then - ./invert <"$f" | ./h48_to_"$type" - else - ./h48_to_"$type" <"$f" - fi - printf ',\n' - done -} - -genfuncs() { - for f in transform_??_???.txt; do - trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" - printf 'static inline cube_fast_t\n_trans_%s' "$trans" - printf '(cube_fast_t c)\n{\n' - printf '\tcube_fast_t ret;\n\n' - printf '\tcube_fast_t tn = ' - ./h48_to_"$type" <"$f" | sed '2,4s/^/\t/' - printf ';\n\tcube_fast_t ti = ' - ./invert <"$f" | ./h48_to_"$type" | sed '2,4 s/^/\t/' - printf ';\n\n\tret = compose_fast(tn, c);\n' - printf '\tret = compose_fast(ret, ti);\n' - if [ -n "$(echo "$trans" | grep "m")" ]; then - printf '\tret = invertco_fast(ret);\n' - fi - printf '\n\treturn ret;\n}\n\n' - done -} - -genfuncs -rm -f h48_to_"$type" invert diff --git a/old/moves_trans/moves_src.c b/old/moves_trans/moves_src.c deleted file mode 100644 index faf4729..0000000 --- a/old/moves_trans/moves_src.c +++ /dev/null @@ -1,264 +0,0 @@ -#define PERM4(r, i, j, k, l) \ - aux = r[i]; \ - r[i] = r[l]; \ - r[l] = r[k]; \ - r[k] = r[j]; \ - r[j] = aux; -#define PERM22(r, i, j, k, l) \ - aux = r[i]; \ - r[i] = r[j]; \ - r[j] = aux; \ - aux = r[k]; \ - r[k] = r[l]; \ - r[l] = aux; -#define CO(a, b) \ - aux = (a & _cobits) + (b & _cobits); \ - auy = (aux + _ctwist_cw) >> 2U; \ - auz = (aux + auy) & _cobits2; \ - a = (a & _pbits) | auz; -#define CO4(r, i, j, k, l) \ - CO(r[i], _ctwist_cw) \ - CO(r[j], _ctwist_cw) \ - CO(r[k], _ctwist_ccw) \ - CO(r[l], _ctwist_ccw) -#define EO4(r, i, j, k, l) \ - r[i] ^= _eobit; \ - r[j] ^= _eobit; \ - r[k] ^= _eobit; \ - r[l] ^= _eobit; - -_static_inline cube_fast_t -_move_U(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_uf, _e_ul, _e_ub, _e_ur) - PERM4(ret.corner, _c_ufr, _c_ufl, _c_ubl, _c_ubr) - - return ret; -} - -_static_inline cube_fast_t -_move_U2(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM22(ret.edge, _e_uf, _e_ub, _e_ul, _e_ur) - PERM22(ret.corner, _c_ufr, _c_ubl, _c_ufl, _c_ubr) - - return ret; -} - -_static_inline cube_fast_t -_move_U3(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_uf, _e_ur, _e_ub, _e_ul) - PERM4(ret.corner, _c_ufr, _c_ubr, _c_ubl, _c_ufl) - - return ret; -} - -_static_inline cube_fast_t -_move_D(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_df, _e_dr, _e_db, _e_dl) - PERM4(ret.corner, _c_dfr, _c_dbr, _c_dbl, _c_dfl) - - return ret; -} - -_static_inline cube_fast_t -_move_D2(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM22(ret.edge, _e_df, _e_db, _e_dr, _e_dl) - PERM22(ret.corner, _c_dfr, _c_dbl, _c_dbr, _c_dfl) - - return ret; -} - -_static_inline cube_fast_t -_move_D3(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_df, _e_dl, _e_db, _e_dr) - PERM4(ret.corner, _c_dfr, _c_dfl, _c_dbl, _c_dbr) - - return ret; -} - -_static_inline cube_fast_t -_move_R(cube_fast_t c) -{ - uint8_t aux, auy, auz; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_ur, _e_br, _e_dr, _e_fr) - PERM4(ret.corner, _c_ufr, _c_ubr, _c_dbr, _c_dfr) - - CO4(ret.corner, _c_ubr, _c_dfr, _c_ufr, _c_dbr) - - return ret; -} - -_static_inline cube_fast_t -_move_R2(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM22(ret.edge, _e_ur, _e_dr, _e_fr, _e_br) - PERM22(ret.corner, _c_ufr, _c_dbr, _c_ubr, _c_dfr) - - return ret; -} - -_static_inline cube_fast_t -_move_R3(cube_fast_t c) -{ - uint8_t aux, auy, auz; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_ur, _e_fr, _e_dr, _e_br) - PERM4(ret.corner, _c_ufr, _c_dfr, _c_dbr, _c_ubr) - - CO4(ret.corner, _c_ubr, _c_dfr, _c_ufr, _c_dbr) - - return ret; -} - -_static_inline cube_fast_t -_move_L(cube_fast_t c) -{ - uint8_t aux, auy, auz; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_ul, _e_fl, _e_dl, _e_bl) - PERM4(ret.corner, _c_ufl, _c_dfl, _c_dbl, _c_ubl) - - CO4(ret.corner, _c_ufl, _c_dbl, _c_dfl, _c_ubl) - - return ret; -} - -_static_inline cube_fast_t -_move_L2(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM22(ret.edge, _e_ul, _e_dl, _e_fl, _e_bl) - PERM22(ret.corner, _c_ufl, _c_dbl, _c_ubl, _c_dfl) - - return ret; -} - -_static_inline cube_fast_t -_move_L3(cube_fast_t c) -{ - uint8_t aux, auy, auz; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_ul, _e_bl, _e_dl, _e_fl) - PERM4(ret.corner, _c_ufl, _c_ubl, _c_dbl, _c_dfl) - - CO4(ret.corner, _c_ufl, _c_dbl, _c_dfl, _c_ubl) - - return ret; -} - -_static_inline cube_fast_t -_move_F(cube_fast_t c) -{ - uint8_t aux, auy, auz; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_uf, _e_fr, _e_df, _e_fl) - PERM4(ret.corner, _c_ufr, _c_dfr, _c_dfl, _c_ufl) - - EO4(ret.edge, _e_uf, _e_fr, _e_df, _e_fl) - CO4(ret.corner, _c_ufr, _c_dfl, _c_dfr, _c_ufl) - - return ret; -} - -_static_inline cube_fast_t -_move_F2(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM22(ret.edge, _e_uf, _e_df, _e_fr, _e_fl) - PERM22(ret.corner, _c_ufr, _c_dfl, _c_ufl, _c_dfr) - - return ret; -} - -_static_inline cube_fast_t -_move_F3(cube_fast_t c) -{ - uint8_t aux, auy, auz; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_uf, _e_fl, _e_df, _e_fr) - PERM4(ret.corner, _c_ufr, _c_ufl, _c_dfl, _c_dfr) - - EO4(ret.edge, _e_uf, _e_fr, _e_df, _e_fl) - CO4(ret.corner, _c_ufr, _c_dfl, _c_dfr, _c_ufl) - - return ret; -} - -_static_inline cube_fast_t -_move_B(cube_fast_t c) -{ - uint8_t aux, auy, auz; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_ub, _e_bl, _e_db, _e_br) - PERM4(ret.corner, _c_ubr, _c_ubl, _c_dbl, _c_dbr) - - EO4(ret.edge, _e_ub, _e_br, _e_db, _e_bl) - CO4(ret.corner, _c_ubl, _c_dbr, _c_dbl, _c_ubr) - - return ret; -} - -_static_inline cube_fast_t -_move_B2(cube_fast_t c) -{ - uint8_t aux; - cube_fast_t ret = c; - - PERM22(ret.edge, _e_ub, _e_db, _e_br, _e_bl) - PERM22(ret.corner, _c_ubr, _c_dbl, _c_ubl, _c_dbr) - - return ret; -} - -_static_inline cube_fast_t -_move_B3(cube_fast_t c) -{ - uint8_t aux, auy, auz; - cube_fast_t ret = c; - - PERM4(ret.edge, _e_ub, _e_br, _e_db, _e_bl) - PERM4(ret.corner, _c_ubr, _c_dbr, _c_dbl, _c_ubl) - - EO4(ret.edge, _e_ub, _e_br, _e_db, _e_bl) - CO4(ret.corner, _c_ubl, _c_dbr, _c_dbl, _c_ubr) - - return ret; -} diff --git a/old/moves_trans/v2/genmovecode.sh b/old/moves_trans/v2/genmovecode.sh deleted file mode 100755 index 9d5fa7a..0000000 --- a/old/moves_trans/v2/genmovecode.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -type="${1:-src}" - -gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type" - -lineavx() { printf '#define _move_cube_%s ' "$1"; } -linesrc() { printf '_static cube_fast_t _move_cube_%s = ' "$1"; } -sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; } -sedsrc() { sed '3s/$/ };/ ; 3q'; } - -gen() { - for f in move_??_*.txt; do - move="$(echo $f | sed 's/.*_// ; s/\.txt//')" - line$type "$move" - ./h48_to_"$type" <"$f" | sed$type - done -} - -gen -rm -f h48_to_"$type" invert diff --git a/old/moves_trans/v2/gentranscode.sh b/old/moves_trans/v2/gentranscode.sh deleted file mode 100755 index b9d41b6..0000000 --- a/old/moves_trans/v2/gentranscode.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -type="${1:-src}" - -gcc -DDEBUG h48_to_"$type".c ../cube.c -o h48_to_"$type" -gcc -DDEBUG invert.c ../cube.c -o invert - -lineavx() { printf '#define _trans_cube_%s ' "$1"; } -linesrc() { printf '_static cube_fast_t _trans_cube_%s = ' "$1"; } -sedavx() { sed '1,2s/$/ \\/ ; 3s/$/)/ ; 3q'; } -sedsrc() { sed '3s/$/ };/ ; 3q'; } - -gen() { - for f in transform_??_???.txt; do - trans="$(echo $f | sed 's/.*_// ; s/\.txt//')" - line$type "$trans" - ./h48_to_"$type" <"$f" | sed$type - line$type "${trans}_inverse" - ./invert <"$f" | ./h48_to_"$type" | sed$type - done -} - -gen -rm -f h48_to_"$type" invert -- cgit v1.3