diff options
Diffstat (limited to 'src/_constants.c')
| -rw-r--r-- | src/_constants.c | 221 |
1 files changed, 221 insertions, 0 deletions
diff --git a/src/_constants.c b/src/_constants.c new file mode 100644 index 0000000..90deffe --- /dev/null +++ b/src/_constants.c | |||
| @@ -0,0 +1,221 @@ | |||
| 1 | #define _c_ufr 0U | ||
| 2 | #define _c_ubl 1U | ||
| 3 | #define _c_dfl 2U | ||
| 4 | #define _c_dbr 3U | ||
| 5 | #define _c_ufl 4U | ||
| 6 | #define _c_ubr 5U | ||
| 7 | #define _c_dfr 6U | ||
| 8 | #define _c_dbl 7U | ||
| 9 | |||
| 10 | #define _e_uf 0U | ||
| 11 | #define _e_ub 1U | ||
| 12 | #define _e_db 2U | ||
| 13 | #define _e_df 3U | ||
| 14 | #define _e_ur 4U | ||
| 15 | #define _e_ul 5U | ||
| 16 | #define _e_dl 6U | ||
| 17 | #define _e_dr 7U | ||
| 18 | #define _e_fr 8U | ||
| 19 | #define _e_fl 9U | ||
| 20 | #define _e_bl 10U | ||
| 21 | #define _e_br 11U | ||
| 22 | |||
| 23 | #define _eoshift 4U | ||
| 24 | #define _coshift 5U | ||
| 25 | |||
| 26 | #define _pbits 0xFU | ||
| 27 | #define _eobit 0x10U | ||
| 28 | #define _cobits 0xF0U | ||
| 29 | #define _cobits2 0x60U | ||
| 30 | #define _ctwist_cw 0x20U | ||
| 31 | #define _ctwist_ccw 0x40U | ||
| 32 | #define _eflip 0x10U | ||
| 33 | #define _error 0xFFU | ||
| 34 | |||
| 35 | move_t inverse_move[] = { | ||
| 36 | [U] = U3, | ||
| 37 | [U2] = U2, | ||
| 38 | [U3] = U, | ||
| 39 | [D] = D3, | ||
| 40 | [D2] = D2, | ||
| 41 | [D3] = D, | ||
| 42 | [R] = R3, | ||
| 43 | [R2] = R2, | ||
| 44 | [R3] = R, | ||
| 45 | [L] = L3, | ||
| 46 | [L2] = L2, | ||
| 47 | [L3] = L, | ||
| 48 | [F] = F3, | ||
| 49 | [F2] = F2, | ||
| 50 | [F3] = F, | ||
| 51 | [B] = B3, | ||
| 52 | [B2] = B2, | ||
| 53 | [B3] = B, | ||
| 54 | }; | ||
| 55 | |||
| 56 | trans_t inverse_trans[] = { | ||
| 57 | [UFr] = UFr, | ||
| 58 | [ULr] = URr, | ||
| 59 | [UBr] = UBr, | ||
| 60 | [URr] = URr, | ||
| 61 | [DFr] = DFr, | ||
| 62 | [DLr] = DLr, | ||
| 63 | [DRr] = DRr, | ||
| 64 | [DBr] = DBr, | ||
| 65 | [RUr] = FRr, | ||
| 66 | [RFr] = LFr, | ||
| 67 | [RDr] = BLr, | ||
| 68 | [RBr] = RBr, | ||
| 69 | [LUr] = FLr, | ||
| 70 | [LFr] = RFr, | ||
| 71 | [LDr] = BRr, | ||
| 72 | [LBr] = LBr, | ||
| 73 | [FUr] = FUr, | ||
| 74 | [FRr] = RUr, | ||
| 75 | [FDr] = BUr, | ||
| 76 | [FLr] = LUr, | ||
| 77 | [BUr] = FDr, | ||
| 78 | [BLr] = RDr, | ||
| 79 | [BDr] = BDr, | ||
| 80 | [BRr] = LDr, | ||
| 81 | [UFm] = UFm, | ||
| 82 | [ULm] = ULm, | ||
| 83 | [UBm] = UBm, | ||
| 84 | [URm] = ULm, | ||
| 85 | [DFm] = DFm, | ||
| 86 | [DLm] = DRm, | ||
| 87 | [DRm] = DLm, | ||
| 88 | [DBm] = DBm, | ||
| 89 | [RUm] = FLm, | ||
| 90 | [RFm] = RFm, | ||
| 91 | [RDm] = BRm, | ||
| 92 | [RBm] = LBm, | ||
| 93 | [LUm] = FRm, | ||
| 94 | [LFm] = LFm, | ||
| 95 | [LDm] = BLm, | ||
| 96 | [LBm] = RBm, | ||
| 97 | [FUm] = FUm, | ||
| 98 | [FRm] = LUm, | ||
| 99 | [FDm] = BUm, | ||
| 100 | [FLm] = RUm, | ||
| 101 | [BUm] = FDm, | ||
| 102 | [BLm] = LDm, | ||
| 103 | [BDm] = BDm, | ||
| 104 | [BRm] = RDm, | ||
| 105 | }; | ||
| 106 | |||
| 107 | cube_t solvedcube = { | ||
| 108 | .c = {0, 1, 2, 3, 4, 5, 6, 7}, | ||
| 109 | .e = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} | ||
| 110 | }; | ||
| 111 | |||
| 112 | static cube_t errorcube = { .e = {0}, .c = {0} }; | ||
| 113 | |||
| 114 | static char *cornerstr[] = { | ||
| 115 | [_c_ufr] = "UFR", | ||
| 116 | [_c_ubl] = "UBL", | ||
| 117 | [_c_dfl] = "DFL", | ||
| 118 | [_c_dbr] = "DBR", | ||
| 119 | [_c_ufl] = "UFL", | ||
| 120 | [_c_ubr] = "UBR", | ||
| 121 | [_c_dfr] = "DFR", | ||
| 122 | [_c_dbl] = "DBL" | ||
| 123 | }; | ||
| 124 | |||
| 125 | static char *cornerstralt[] = { | ||
| 126 | [_c_ufr] = "URF", | ||
| 127 | [_c_ubl] = "ULB", | ||
| 128 | [_c_dfl] = "DLF", | ||
| 129 | [_c_dbr] = "DRB", | ||
| 130 | [_c_ufl] = "ULF", | ||
| 131 | [_c_ubr] = "URB", | ||
| 132 | [_c_dfr] = "DRF", | ||
| 133 | [_c_dbl] = "DLB" | ||
| 134 | }; | ||
| 135 | |||
| 136 | static char *edgestr[] = { | ||
| 137 | [_e_uf] = "UF", | ||
| 138 | [_e_ub] = "UB", | ||
| 139 | [_e_db] = "DB", | ||
| 140 | [_e_df] = "DF", | ||
| 141 | [_e_ur] = "UR", | ||
| 142 | [_e_ul] = "UL", | ||
| 143 | [_e_dl] = "DL", | ||
| 144 | [_e_dr] = "DR", | ||
| 145 | [_e_fr] = "FR", | ||
| 146 | [_e_fl] = "FL", | ||
| 147 | [_e_bl] = "BL", | ||
| 148 | [_e_br] = "BR" | ||
| 149 | }; | ||
| 150 | |||
| 151 | static char *movestr[] = { | ||
| 152 | [U] = "U", | ||
| 153 | [U2] = "U2", | ||
| 154 | [U3] = "U'", | ||
| 155 | [D] = "D", | ||
| 156 | [D2] = "D2", | ||
| 157 | [D3] = "D'", | ||
| 158 | [R] = "R", | ||
| 159 | [R2] = "R2", | ||
| 160 | [R3] = "R'", | ||
| 161 | [L] = "L", | ||
| 162 | [L2] = "L2", | ||
| 163 | [L3] = "L'", | ||
| 164 | [F] = "F", | ||
| 165 | [F2] = "F2", | ||
| 166 | [F3] = "F'", | ||
| 167 | [B] = "B", | ||
| 168 | [B2] = "B2", | ||
| 169 | [B3] = "B'", | ||
| 170 | }; | ||
| 171 | |||
| 172 | static char *transstr[] = { | ||
| 173 | [UFr] = "rotation UF", | ||
| 174 | [UFm] = "mirrored UF", | ||
| 175 | [ULr] = "rotation UL", | ||
| 176 | [ULm] = "mirrored UL", | ||
| 177 | [UBr] = "rotation UB", | ||
| 178 | [UBm] = "mirrored UB", | ||
| 179 | [URr] = "rotation UR", | ||
| 180 | [URm] = "mirrored UR", | ||
| 181 | [DFr] = "rotation DF", | ||
| 182 | [DFm] = "mirrored DF", | ||
| 183 | [DLr] = "rotation DL", | ||
| 184 | [DLm] = "mirrored DL", | ||
| 185 | [DBr] = "rotation DB", | ||
| 186 | [DBm] = "mirrored DB", | ||
| 187 | [DRr] = "rotation DR", | ||
| 188 | [DRm] = "mirrored DR", | ||
| 189 | [RUr] = "rotation RU", | ||
| 190 | [RUm] = "mirrored RU", | ||
| 191 | [RFr] = "rotation RF", | ||
| 192 | [RFm] = "mirrored RF", | ||
| 193 | [RDr] = "rotation RD", | ||
| 194 | [RDm] = "mirrored RD", | ||
| 195 | [RBr] = "rotation RB", | ||
| 196 | [RBm] = "mirrored RB", | ||
| 197 | [LUr] = "rotation LU", | ||
| 198 | [LUm] = "mirrored LU", | ||
| 199 | [LFr] = "rotation LF", | ||
| 200 | [LFm] = "mirrored LF", | ||
| 201 | [LDr] = "rotation LD", | ||
| 202 | [LDm] = "mirrored LD", | ||
| 203 | [LBr] = "rotation LB", | ||
| 204 | [LBm] = "mirrored LB", | ||
| 205 | [FUr] = "rotation FU", | ||
| 206 | [FUm] = "mirrored FU", | ||
| 207 | [FRr] = "rotation FR", | ||
| 208 | [FRm] = "mirrored FR", | ||
| 209 | [FDr] = "rotation FD", | ||
| 210 | [FDm] = "mirrored FD", | ||
| 211 | [FLr] = "rotation FL", | ||
| 212 | [FLm] = "mirrored FL", | ||
| 213 | [BUr] = "rotation BU", | ||
| 214 | [BUm] = "mirrored BU", | ||
| 215 | [BRr] = "rotation BR", | ||
| 216 | [BRm] = "mirrored BR", | ||
| 217 | [BDr] = "rotation BD", | ||
| 218 | [BDm] = "mirrored BD", | ||
| 219 | [BLr] = "rotation BL", | ||
| 220 | [BLm] = "mirrored BL", | ||
| 221 | }; | ||
