cubecore

A library of core functions for working with 3x3x3 Rubik's cubes
git clone https://git.tronto.net/cubecore
Download | Log | Files | Refs | README | LICENSE

constants.h (18020B)


      1 #define NORMAL 0
      2 #define INVERSE 1
      3 
      4 #define _2p11  2048U
      5 #define _2p12  4096U
      6 #define _3p7   2187U
      7 #define _3p8   6561U
      8 #define _12c4  495U
      9 #define _8c4   70U
     10 
     11 #define _c_ufr      0U
     12 #define _c_ubl      1U
     13 #define _c_dfl      2U
     14 #define _c_dbr      3U
     15 #define _c_ufl      4U
     16 #define _c_ubr      5U
     17 #define _c_dfr      6U
     18 #define _c_dbl      7U
     19 
     20 #define _e_uf       0U
     21 #define _e_ub       1U
     22 #define _e_db       2U
     23 #define _e_df       3U
     24 #define _e_ur       4U
     25 #define _e_ul       5U
     26 #define _e_dl       6U
     27 #define _e_dr       7U
     28 #define _e_fr       8U
     29 #define _e_fl       9U
     30 #define _e_bl       10U
     31 #define _e_br       11U
     32 
     33 #define _eoshift    4U
     34 #define _coshift    5U
     35 
     36 #define _pbits      0xFU
     37 #define _esepbit1   0x4U
     38 #define _esepbit2   0x8U
     39 #define _csepbit    0x4U
     40 #define _eobit      0x10U
     41 #define _cobits     0xF0U
     42 #define _cobits2    0x60U
     43 #define _ctwist_cw  0x20U
     44 #define _ctwist_ccw 0x40U
     45 #define _eflip      0x10U
     46 #define _error      0xFFU
     47 
     48 _static cube_t zero = { .corner = {0}, .edge = {0} };
     49 _static cube_t solved = {
     50 	.corner = {0, 1, 2, 3, 4, 5, 6, 7},
     51 	.edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
     52 };
     53 
     54 _static cube_t move_table[] = {
     55 	[U] = {
     56 		.corner = {5, 4, 2, 3, 0, 1, 6, 7},
     57 		.edge = {4, 5, 2, 3, 1, 0, 6, 7, 8, 9, 10, 11}
     58 	},
     59 	[U2] = {
     60 		.corner = {1, 0, 2, 3, 5, 4, 6, 7},
     61 		.edge = {1, 0, 2, 3, 5, 4, 6, 7, 8, 9, 10, 11}
     62 	},
     63 	[U3] = {
     64 		.corner = {4, 5, 2, 3, 1, 0, 6, 7},
     65 		.edge = {5, 4, 2, 3, 0, 1, 6, 7, 8, 9, 10, 11}
     66 	},
     67 	[D] = {
     68 		.corner = {0, 1, 7, 6, 4, 5, 2, 3},
     69 		.edge = {0, 1, 7, 6, 4, 5, 2, 3, 8, 9, 10, 11}
     70 	},
     71 	[D2] = {
     72 		.corner = {0, 1, 3, 2, 4, 5, 7, 6},
     73 		.edge = {0, 1, 3, 2, 4, 5, 7, 6, 8, 9, 10, 11}
     74 	},
     75 	[D3] = {
     76 		.corner = {0, 1, 6, 7, 4, 5, 3, 2},
     77 		.edge = {0, 1, 6, 7, 4, 5, 3, 2, 8, 9, 10, 11}
     78 	},
     79 	[R] = {
     80 		.corner = {70, 1, 2, 69, 4, 32, 35, 7},
     81 		.edge = {0, 1, 2, 3, 8, 5, 6, 11, 7, 9, 10, 4}
     82 	},
     83 	[R2] = {
     84 		.corner = {3, 1, 2, 0, 4, 6, 5, 7},
     85 		.edge = {0, 1, 2, 3, 7, 5, 6, 4, 11, 9, 10, 8}
     86 	},
     87 	[R3] = {
     88 		.corner = {69, 1, 2, 70, 4, 35, 32, 7},
     89 		.edge = {0, 1, 2, 3, 11, 5, 6, 8, 4, 9, 10, 7}
     90 	},
     91 	[L] = {
     92 		.corner = {0, 71, 68, 3, 33, 5, 6, 34},
     93 		.edge = {0, 1, 2, 3, 4, 10, 9, 7, 8, 5, 6, 11}
     94 	},
     95 	[L2] = {
     96 		.corner = {0, 2, 1, 3, 7, 5, 6, 4},
     97 		.edge = {0, 1, 2, 3, 4, 6, 5, 7, 8, 10, 9, 11}
     98 	},
     99 	[L3] = {
    100 		.corner = {0, 68, 71, 3, 34, 5, 6, 33},
    101 		.edge = {0, 1, 2, 3, 4, 9, 10, 7, 8, 6, 5, 11}
    102 	},
    103 	[F] = {
    104 		.corner = {36, 1, 38, 3, 66, 5, 64, 7},
    105 		.edge = {25, 1, 2, 24, 4, 5, 6, 7, 16, 19, 10, 11}
    106 	},
    107 	[F2] = {
    108 		.corner = {2, 1, 0, 3, 6, 5, 4, 7},
    109 		.edge = {3, 1, 2, 0, 4, 5, 6, 7, 9, 8, 10, 11}
    110 	},
    111 	[F3] = {
    112 		.corner = {38, 1, 36, 3, 64, 5, 66, 7},
    113 		.edge = {24, 1, 2, 25, 4, 5, 6, 7, 19, 16, 10, 11}
    114 	},
    115 	[B] = {
    116 		.corner = {0, 37, 2, 39, 4, 67, 6, 65},
    117 		.edge = {0, 27, 26, 3, 4, 5, 6, 7, 8, 9, 17, 18}
    118 	},
    119 	[B2] = {
    120 		.corner = {0, 3, 2, 1, 4, 7, 6, 5},
    121 		.edge = {0, 2, 1, 3, 4, 5, 6, 7, 8, 9, 11, 10}
    122 	},
    123 	[B3] = {
    124 		.corner = {0, 39, 2, 37, 4, 65, 6, 67},
    125 		.edge = {0, 26, 27, 3, 4, 5, 6, 7, 8, 9, 18, 17}
    126 	},
    127 };
    128 
    129 _static cube_t trans_table[][2] = {
    130 	[UFr] = {
    131 		[NORMAL] = {
    132 			.corner = {0, 1, 2, 3, 4, 5, 6, 7},
    133 			.edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
    134 		},
    135 		[INVERSE] = {
    136 			.corner = {0, 1, 2, 3, 4, 5, 6, 7},
    137 			.edge = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
    138 		}
    139 	},
    140 	[ULr] = {
    141 		[NORMAL] = {
    142 			.corner = {4, 5, 7, 6, 1, 0, 2, 3},
    143 			.edge = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24}
    144 		},
    145 		[INVERSE] = {
    146 			.corner = {5, 4, 6, 7, 0, 1, 3, 2},
    147 			.edge = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26}
    148 		}
    149 	},
    150 	[UBr] = {
    151 		[NORMAL] = {
    152 			.corner = {1, 0, 3, 2, 5, 4, 7, 6},
    153 			.edge = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9}
    154 		},
    155 		[INVERSE] = {
    156 			.corner = {1, 0, 3, 2, 5, 4, 7, 6},
    157 			.edge = {1, 0, 3, 2, 5, 4, 7, 6, 10, 11, 8, 9}
    158 		}
    159 	},
    160 	[URr] = {
    161 		[NORMAL] = {
    162 			.corner = {5, 4, 6, 7, 0, 1, 3, 2},
    163 			.edge = {4, 5, 6, 7, 1, 0, 3, 2, 27, 24, 25, 26}
    164 		},
    165 		[INVERSE] = {
    166 			.corner = {4, 5, 7, 6, 1, 0, 2, 3},
    167 			.edge = {5, 4, 7, 6, 0, 1, 2, 3, 25, 26, 27, 24}
    168 		}
    169 	},
    170 	[DFr] = {
    171 		[NORMAL] = {
    172 			.corner = {2, 3, 0, 1, 6, 7, 4, 5},
    173 			.edge = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10}
    174 		},
    175 		[INVERSE] = {
    176 			.corner = {2, 3, 0, 1, 6, 7, 4, 5},
    177 			.edge = {3, 2, 1, 0, 6, 7, 4, 5, 9, 8, 11, 10}
    178 		}
    179 	},
    180 	[DLr] = {
    181 		[NORMAL] = {
    182 			.corner = {7, 6, 4, 5, 2, 3, 1, 0},
    183 			.edge = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27}
    184 		},
    185 		[INVERSE] = {
    186 			.corner = {7, 6, 4, 5, 2, 3, 1, 0},
    187 			.edge = {6, 7, 4, 5, 2, 3, 0, 1, 26, 25, 24, 27}
    188 		}
    189 	},
    190 	[DBr] = {
    191 		[NORMAL] = {
    192 			.corner = {3, 2, 1, 0, 7, 6, 5, 4},
    193 			.edge = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8}
    194 		},
    195 		[INVERSE] = {
    196 			.corner = {3, 2, 1, 0, 7, 6, 5, 4},
    197 			.edge = {2, 3, 0, 1, 7, 6, 5, 4, 11, 10, 9, 8}
    198 		}
    199 	},
    200 	[DRr] = {
    201 		[NORMAL] = {
    202 			.corner = {6, 7, 5, 4, 3, 2, 0, 1},
    203 			.edge = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25}
    204 		},
    205 		[INVERSE] = {
    206 			.corner = {6, 7, 5, 4, 3, 2, 0, 1},
    207 			.edge = {7, 6, 5, 4, 3, 2, 1, 0, 24, 27, 26, 25}
    208 		}
    209 	},
    210 	[RUr] = {
    211 		[NORMAL] = {
    212 			.corner = {64, 67, 65, 66, 37, 38, 36, 39},
    213 			.edge = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3}
    214 		},
    215 		[INVERSE] = {
    216 			.corner = {32, 34, 35, 33, 70, 68, 69, 71},
    217 			.edge = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21}
    218 		}
    219 	},
    220 	[RFr] = {
    221 		[NORMAL] = {
    222 			.corner = {38, 37, 36, 39, 64, 67, 66, 65},
    223 			.edge = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18}
    224 		},
    225 		[INVERSE] = {
    226 			.corner = {36, 39, 38, 37, 66, 65, 64, 67},
    227 			.edge = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17}
    228 		}
    229 	},
    230 	[RDr] = {
    231 		[NORMAL] = {
    232 			.corner = {67, 64, 66, 65, 38, 37, 39, 36},
    233 			.edge = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1}
    234 		},
    235 		[INVERSE] = {
    236 			.corner = {33, 35, 34, 32, 71, 69, 68, 70},
    237 			.edge = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20}
    238 		}
    239 	},
    240 	[RBr] = {
    241 		[NORMAL] = {
    242 			.corner = {37, 38, 39, 36, 67, 64, 65, 66},
    243 			.edge = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16}
    244 		},
    245 		[INVERSE] = {
    246 			.corner = {37, 38, 39, 36, 67, 64, 65, 66},
    247 			.edge = {27, 24, 25, 26, 20, 23, 22, 21, 17, 18, 19, 16}
    248 		}
    249 	},
    250 	[LUr] = {
    251 		[NORMAL] = {
    252 			.corner = {65, 66, 64, 67, 36, 39, 37, 38},
    253 			.edge = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2}
    254 		},
    255 		[INVERSE] = {
    256 			.corner = {34, 32, 33, 35, 68, 70, 71, 69},
    257 			.edge = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23}
    258 		}
    259 	},
    260 	[LFr] = {
    261 		[NORMAL] = {
    262 			.corner = {36, 39, 38, 37, 66, 65, 64, 67},
    263 			.edge = {25, 26, 27, 24, 21, 22, 23, 20, 16, 19, 18, 17}
    264 		},
    265 		[INVERSE] = {
    266 			.corner = {38, 37, 36, 39, 64, 67, 66, 65},
    267 			.edge = {24, 27, 26, 25, 23, 20, 21, 22, 19, 16, 17, 18}
    268 		}
    269 	},
    270 	[LDr] = {
    271 		[NORMAL] = {
    272 			.corner = {66, 65, 67, 64, 39, 36, 38, 37},
    273 			.edge = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0}
    274 		},
    275 		[INVERSE] = {
    276 			.corner = {35, 33, 32, 34, 69, 71, 70, 68},
    277 			.edge = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22}
    278 		}
    279 	},
    280 	[LBr] = {
    281 		[NORMAL] = {
    282 			.corner = {39, 36, 37, 38, 65, 66, 67, 64},
    283 			.edge = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19}
    284 		},
    285 		[INVERSE] = {
    286 			.corner = {39, 36, 37, 38, 65, 66, 67, 64},
    287 			.edge = {26, 25, 24, 27, 22, 21, 20, 23, 18, 17, 16, 19}
    288 		}
    289 	},
    290 	[FUr] = {
    291 		[NORMAL] = {
    292 			.corner = {68, 70, 69, 71, 32, 34, 33, 35},
    293 			.edge = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6}
    294 		},
    295 		[INVERSE] = {
    296 			.corner = {68, 70, 69, 71, 32, 34, 33, 35},
    297 			.edge = {16, 19, 18, 17, 9, 8, 11, 10, 5, 4, 7, 6}
    298 		}
    299 	},
    300 	[FRr] = {
    301 		[NORMAL] = {
    302 			.corner = {32, 34, 35, 33, 70, 68, 69, 71},
    303 			.edge = {8, 9, 10, 11, 16, 19, 18, 17, 20, 23, 22, 21}
    304 		},
    305 		[INVERSE] = {
    306 			.corner = {64, 67, 65, 66, 37, 38, 36, 39},
    307 			.edge = {20, 23, 22, 21, 24, 27, 26, 25, 0, 1, 2, 3}
    308 		}
    309 	},
    310 	[FDr] = {
    311 		[NORMAL] = {
    312 			.corner = {70, 68, 71, 69, 34, 32, 35, 33},
    313 			.edge = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4}
    314 		},
    315 		[INVERSE] = {
    316 			.corner = {69, 71, 68, 70, 33, 35, 32, 34},
    317 			.edge = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7}
    318 		}
    319 	},
    320 	[FLr] = {
    321 		[NORMAL] = {
    322 			.corner = {34, 32, 33, 35, 68, 70, 71, 69},
    323 			.edge = {9, 8, 11, 10, 19, 16, 17, 18, 22, 21, 20, 23}
    324 		},
    325 		[INVERSE] = {
    326 			.corner = {65, 66, 64, 67, 36, 39, 37, 38},
    327 			.edge = {21, 22, 23, 20, 26, 25, 24, 27, 1, 0, 3, 2}
    328 		}
    329 	},
    330 	[BUr] = {
    331 		[NORMAL] = {
    332 			.corner = {69, 71, 68, 70, 33, 35, 32, 34},
    333 			.edge = {17, 18, 19, 16, 11, 10, 9, 8, 4, 5, 6, 7}
    334 		},
    335 		[INVERSE] = {
    336 			.corner = {70, 68, 71, 69, 34, 32, 35, 33},
    337 			.edge = {19, 16, 17, 18, 8, 9, 10, 11, 7, 6, 5, 4}
    338 		}
    339 	},
    340 	[BRr] = {
    341 		[NORMAL] = {
    342 			.corner = {35, 33, 32, 34, 69, 71, 70, 68},
    343 			.edge = {11, 10, 9, 8, 18, 17, 16, 19, 23, 20, 21, 22}
    344 		},
    345 		[INVERSE] = {
    346 			.corner = {66, 65, 67, 64, 39, 36, 38, 37},
    347 			.edge = {22, 21, 20, 23, 25, 26, 27, 24, 3, 2, 1, 0}
    348 		}
    349 	},
    350 	[BDr] = {
    351 		[NORMAL] = {
    352 			.corner = {71, 69, 70, 68, 35, 33, 34, 32},
    353 			.edge = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5}
    354 		},
    355 		[INVERSE] = {
    356 			.corner = {71, 69, 70, 68, 35, 33, 34, 32},
    357 			.edge = {18, 17, 16, 19, 10, 11, 8, 9, 6, 7, 4, 5}
    358 		}
    359 	},
    360 	[BLr] = {
    361 		[NORMAL] = {
    362 			.corner = {33, 35, 34, 32, 71, 69, 68, 70},
    363 			.edge = {10, 11, 8, 9, 17, 18, 19, 16, 21, 22, 23, 20}
    364 		},
    365 		[INVERSE] = {
    366 			.corner = {67, 64, 66, 65, 38, 37, 39, 36},
    367 			.edge = {23, 20, 21, 22, 27, 24, 25, 26, 2, 3, 0, 1}
    368 		}
    369 	},
    370 	[UFm] = {
    371 		[NORMAL] = {
    372 			.corner = {4, 5, 6, 7, 0, 1, 2, 3},
    373 			.edge = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10}
    374 		},
    375 		[INVERSE] = {
    376 			.corner = {4, 5, 6, 7, 0, 1, 2, 3},
    377 			.edge = {0, 1, 2, 3, 5, 4, 7, 6, 9, 8, 11, 10}
    378 		}
    379 	},
    380 	[ULm] = {
    381 		[NORMAL] = {
    382 			.corner = {0, 1, 3, 2, 5, 4, 6, 7},
    383 			.edge = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25}
    384 		},
    385 		[INVERSE] = {
    386 			.corner = {0, 1, 3, 2, 5, 4, 6, 7},
    387 			.edge = {4, 5, 6, 7, 0, 1, 2, 3, 24, 27, 26, 25}
    388 		}
    389 	},
    390 	[UBm] = {
    391 		[NORMAL] = {
    392 			.corner = {5, 4, 7, 6, 1, 0, 3, 2},
    393 			.edge = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8}
    394 		},
    395 		[INVERSE] = {
    396 			.corner = {5, 4, 7, 6, 1, 0, 3, 2},
    397 			.edge = {1, 0, 3, 2, 4, 5, 6, 7, 11, 10, 9, 8}
    398 		}
    399 	},
    400 	[URm] = {
    401 		[NORMAL] = {
    402 			.corner = {1, 0, 2, 3, 4, 5, 7, 6},
    403 			.edge = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27}
    404 		},
    405 		[INVERSE] = {
    406 			.corner = {1, 0, 2, 3, 4, 5, 7, 6},
    407 			.edge = {5, 4, 7, 6, 1, 0, 3, 2, 26, 25, 24, 27}
    408 		}
    409 	},
    410 	[DFm] = {
    411 		[NORMAL] = {
    412 			.corner = {6, 7, 4, 5, 2, 3, 0, 1},
    413 			.edge = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11}
    414 		},
    415 		[INVERSE] = {
    416 			.corner = {6, 7, 4, 5, 2, 3, 0, 1},
    417 			.edge = {3, 2, 1, 0, 7, 6, 5, 4, 8, 9, 10, 11}
    418 		}
    419 	},
    420 	[DLm] = {
    421 		[NORMAL] = {
    422 			.corner = {3, 2, 0, 1, 6, 7, 5, 4},
    423 			.edge = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26}
    424 		},
    425 		[INVERSE] = {
    426 			.corner = {2, 3, 1, 0, 7, 6, 4, 5},
    427 			.edge = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24}
    428 		}
    429 	},
    430 	[DBm] = {
    431 		[NORMAL] = {
    432 			.corner = {7, 6, 5, 4, 3, 2, 1, 0},
    433 			.edge = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9}
    434 		},
    435 		[INVERSE] = {
    436 			.corner = {7, 6, 5, 4, 3, 2, 1, 0},
    437 			.edge = {2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 8, 9}
    438 		}
    439 	},
    440 	[DRm] = {
    441 		[NORMAL] = {
    442 			.corner = {2, 3, 1, 0, 7, 6, 4, 5},
    443 			.edge = {6, 7, 4, 5, 3, 2, 1, 0, 25, 26, 27, 24}
    444 		},
    445 		[INVERSE] = {
    446 			.corner = {3, 2, 0, 1, 6, 7, 5, 4},
    447 			.edge = {7, 6, 5, 4, 2, 3, 0, 1, 27, 24, 25, 26}
    448 		}
    449 	},
    450 	[RUm] = {
    451 		[NORMAL] = {
    452 			.corner = {68, 71, 69, 70, 33, 34, 32, 35},
    453 			.edge = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3}
    454 		},
    455 		[INVERSE] = {
    456 			.corner = {70, 68, 69, 71, 32, 34, 35, 33},
    457 			.edge = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22}
    458 		}
    459 	},
    460 	[RFm] = {
    461 		[NORMAL] = {
    462 			.corner = {34, 33, 32, 35, 68, 71, 70, 69},
    463 			.edge = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18}
    464 		},
    465 		[INVERSE] = {
    466 			.corner = {66, 65, 64, 67, 36, 39, 38, 37},
    467 			.edge = {25, 26, 27, 24, 22, 21, 20, 23, 19, 16, 17, 18}
    468 		}
    469 	},
    470 	[RDm] = {
    471 		[NORMAL] = {
    472 			.corner = {71, 68, 70, 69, 34, 33, 35, 32},
    473 			.edge = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1}
    474 		},
    475 		[INVERSE] = {
    476 			.corner = {71, 69, 68, 70, 33, 35, 34, 32},
    477 			.edge = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23}
    478 		}
    479 	},
    480 	[RBm] = {
    481 		[NORMAL] = {
    482 			.corner = {33, 34, 35, 32, 71, 68, 69, 70},
    483 			.edge = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16}
    484 		},
    485 		[INVERSE] = {
    486 			.corner = {67, 64, 65, 66, 37, 38, 39, 36},
    487 			.edge = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19}
    488 		}
    489 	},
    490 	[LUm] = {
    491 		[NORMAL] = {
    492 			.corner = {69, 70, 68, 71, 32, 35, 33, 34},
    493 			.edge = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2}
    494 		},
    495 		[INVERSE] = {
    496 			.corner = {68, 70, 71, 69, 34, 32, 33, 35},
    497 			.edge = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20}
    498 		}
    499 	},
    500 	[LFm] = {
    501 		[NORMAL] = {
    502 			.corner = {32, 35, 34, 33, 70, 69, 68, 71},
    503 			.edge = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17}
    504 		},
    505 		[INVERSE] = {
    506 			.corner = {64, 67, 66, 65, 38, 37, 36, 39},
    507 			.edge = {24, 27, 26, 25, 20, 23, 22, 21, 16, 19, 18, 17}
    508 		}
    509 	},
    510 	[LDm] = {
    511 		[NORMAL] = {
    512 			.corner = {70, 69, 71, 68, 35, 32, 34, 33},
    513 			.edge = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0}
    514 		},
    515 		[INVERSE] = {
    516 			.corner = {69, 71, 70, 68, 35, 33, 32, 34},
    517 			.edge = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21}
    518 		}
    519 	},
    520 	[LBm] = {
    521 		[NORMAL] = {
    522 			.corner = {35, 32, 33, 34, 69, 70, 71, 68},
    523 			.edge = {27, 24, 25, 26, 23, 20, 21, 22, 18, 17, 16, 19}
    524 		},
    525 		[INVERSE] = {
    526 			.corner = {65, 66, 67, 64, 39, 36, 37, 38},
    527 			.edge = {26, 25, 24, 27, 21, 22, 23, 20, 17, 18, 19, 16}
    528 		}
    529 	},
    530 	[FUm] = {
    531 		[NORMAL] = {
    532 			.corner = {64, 66, 65, 67, 36, 38, 37, 39},
    533 			.edge = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7}
    534 		},
    535 		[INVERSE] = {
    536 			.corner = {32, 34, 33, 35, 68, 70, 69, 71},
    537 			.edge = {16, 19, 18, 17, 8, 9, 10, 11, 4, 5, 6, 7}
    538 		}
    539 	},
    540 	[FRm] = {
    541 		[NORMAL] = {
    542 			.corner = {36, 38, 39, 37, 66, 64, 65, 67},
    543 			.edge = {9, 8, 11, 10, 16, 19, 18, 17, 21, 22, 23, 20}
    544 		},
    545 		[INVERSE] = {
    546 			.corner = {37, 38, 36, 39, 64, 67, 65, 66},
    547 			.edge = {20, 23, 22, 21, 27, 24, 25, 26, 1, 0, 3, 2}
    548 		}
    549 	},
    550 	[FDm] = {
    551 		[NORMAL] = {
    552 			.corner = {66, 64, 67, 65, 38, 36, 39, 37},
    553 			.edge = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5}
    554 		},
    555 		[INVERSE] = {
    556 			.corner = {33, 35, 32, 34, 69, 71, 68, 70},
    557 			.edge = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6}
    558 		}
    559 	},
    560 	[FLm] = {
    561 		[NORMAL] = {
    562 			.corner = {38, 36, 37, 39, 64, 66, 67, 65},
    563 			.edge = {8, 9, 10, 11, 19, 16, 17, 18, 23, 20, 21, 22}
    564 		},
    565 		[INVERSE] = {
    566 			.corner = {36, 39, 37, 38, 65, 66, 64, 67},
    567 			.edge = {21, 22, 23, 20, 25, 26, 27, 24, 0, 1, 2, 3}
    568 		}
    569 	},
    570 	[BUm] = {
    571 		[NORMAL] = {
    572 			.corner = {65, 67, 64, 66, 37, 39, 36, 38},
    573 			.edge = {17, 18, 19, 16, 10, 11, 8, 9, 5, 4, 7, 6}
    574 		},
    575 		[INVERSE] = {
    576 			.corner = {34, 32, 35, 33, 70, 68, 71, 69},
    577 			.edge = {19, 16, 17, 18, 9, 8, 11, 10, 6, 7, 4, 5}
    578 		}
    579 	},
    580 	[BRm] = {
    581 		[NORMAL] = {
    582 			.corner = {39, 37, 36, 38, 65, 67, 66, 64},
    583 			.edge = {10, 11, 8, 9, 18, 17, 16, 19, 22, 21, 20, 23}
    584 		},
    585 		[INVERSE] = {
    586 			.corner = {39, 36, 38, 37, 66, 65, 67, 64},
    587 			.edge = {22, 21, 20, 23, 26, 25, 24, 27, 2, 3, 0, 1}
    588 		}
    589 	},
    590 	[BDm] = {
    591 		[NORMAL] = {
    592 			.corner = {67, 65, 66, 64, 39, 37, 38, 36},
    593 			.edge = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4}
    594 		},
    595 		[INVERSE] = {
    596 			.corner = {35, 33, 34, 32, 71, 69, 70, 68},
    597 			.edge = {18, 17, 16, 19, 11, 10, 9, 8, 7, 6, 5, 4}
    598 		}
    599 	},
    600 	[BLm] = {
    601 		[NORMAL] = {
    602 			.corner = {37, 39, 38, 36, 67, 65, 64, 66},
    603 			.edge = {11, 10, 9, 8, 17, 18, 19, 16, 20, 23, 22, 21}
    604 		},
    605 		[INVERSE] = {
    606 			.corner = {38, 37, 39, 36, 67, 64, 66, 65},
    607 			.edge = {23, 20, 21, 22, 24, 27, 26, 25, 3, 2, 1, 0}
    608 		}
    609 	},
    610 };
    611 
    612 _static char *cornerstr[] = {
    613 	[_c_ufr] = "UFR",
    614 	[_c_ubl] = "UBL",
    615 	[_c_dfl] = "DFL",
    616 	[_c_dbr] = "DBR",
    617 	[_c_ufl] = "UFL",
    618 	[_c_ubr] = "UBR",
    619 	[_c_dfr] = "DFR",
    620 	[_c_dbl] = "DBL"
    621 };
    622 
    623 _static char *cornerstralt[] = {
    624 	[_c_ufr] = "URF",
    625 	[_c_ubl] = "ULB",
    626 	[_c_dfl] = "DLF",
    627 	[_c_dbr] = "DRB",
    628 	[_c_ufl] = "ULF",
    629 	[_c_ubr] = "URB",
    630 	[_c_dfr] = "DRF",
    631 	[_c_dbl] = "DLB"
    632 };
    633 
    634 _static char *edgestr[] = {
    635 	[_e_uf] = "UF",
    636 	[_e_ub] = "UB",
    637 	[_e_db] = "DB",
    638 	[_e_df] = "DF",
    639 	[_e_ur] = "UR",
    640 	[_e_ul] = "UL",
    641 	[_e_dl] = "DL",
    642 	[_e_dr] = "DR",
    643 	[_e_fr] = "FR",
    644 	[_e_fl] = "FL",
    645 	[_e_bl] = "BL",
    646 	[_e_br] = "BR"
    647 };
    648 
    649 _static char *movestr[] = {
    650 	[U]  = "U",
    651 	[U2] = "U2",
    652 	[U3] = "U'",
    653 	[D]  = "D",
    654 	[D2] = "D2",
    655 	[D3] = "D'",
    656 	[R]  = "R",
    657 	[R2] = "R2",
    658 	[R3] = "R'",
    659 	[L]  = "L",
    660 	[L2] = "L2",
    661 	[L3] = "L'",
    662 	[F]  = "F",
    663 	[F2] = "F2",
    664 	[F3] = "F'",
    665 	[B]  = "B",
    666 	[B2] = "B2",
    667 	[B3] = "B'",
    668 };
    669 
    670 _static char *transstr[] = {
    671 	[UFr] = "rotation UF",
    672 	[UFm] = "mirrored UF",
    673 	[ULr] = "rotation UL",
    674 	[ULm] = "mirrored UL",
    675 	[UBr] = "rotation UB",
    676 	[UBm] = "mirrored UB",
    677 	[URr] = "rotation UR",
    678 	[URm] = "mirrored UR",
    679 	[DFr] = "rotation DF",
    680 	[DFm] = "mirrored DF",
    681 	[DLr] = "rotation DL",
    682 	[DLm] = "mirrored DL",
    683 	[DBr] = "rotation DB",
    684 	[DBm] = "mirrored DB",
    685 	[DRr] = "rotation DR",
    686 	[DRm] = "mirrored DR",
    687 	[RUr] = "rotation RU",
    688 	[RUm] = "mirrored RU",
    689 	[RFr] = "rotation RF",
    690 	[RFm] = "mirrored RF",
    691 	[RDr] = "rotation RD",
    692 	[RDm] = "mirrored RD",
    693 	[RBr] = "rotation RB",
    694 	[RBm] = "mirrored RB",
    695 	[LUr] = "rotation LU",
    696 	[LUm] = "mirrored LU",
    697 	[LFr] = "rotation LF",
    698 	[LFm] = "mirrored LF",
    699 	[LDr] = "rotation LD",
    700 	[LDm] = "mirrored LD",
    701 	[LBr] = "rotation LB",
    702 	[LBm] = "mirrored LB",
    703 	[FUr] = "rotation FU",
    704 	[FUm] = "mirrored FU",
    705 	[FRr] = "rotation FR",
    706 	[FRm] = "mirrored FR",
    707 	[FDr] = "rotation FD",
    708 	[FDm] = "mirrored FD",
    709 	[FLr] = "rotation FL",
    710 	[FLm] = "mirrored FL",
    711 	[BUr] = "rotation BU",
    712 	[BUm] = "mirrored BU",
    713 	[BRr] = "rotation BR",
    714 	[BRm] = "mirrored BR",
    715 	[BDr] = "rotation BD",
    716 	[BDm] = "mirrored BD",
    717 	[BLr] = "rotation BL",
    718 	[BLm] = "mirrored BL",
    719 };
    720 
    721 static uint8_t inverse_trans_table[48] = {
    722 	[UFr] = UFr,
    723 	[UFm] = UFm,
    724 	[ULr] = URr,
    725 	[ULm] = ULm,
    726 	[UBr] = UBr,
    727 	[UBm] = UBm,
    728 	[URr] = ULr,
    729 	[URm] = URm,
    730 	[DFr] = DFr,
    731 	[DFm] = DFm,
    732 	[DLr] = DLr,
    733 	[DLm] = DRm,
    734 	[DBr] = DBr,
    735 	[DBm] = DBm,
    736 	[DRr] = DRr,
    737 	[DRm] = DLm,
    738 	[RUr] = FRr,
    739 	[RUm] = FLm,
    740 	[RFr] = LFr,
    741 	[RFm] = RFm,
    742 	[RDr] = BLr,
    743 	[RDm] = BRm,
    744 	[RBr] = RBr,
    745 	[RBm] = LBm,
    746 	[LUr] = FLr,
    747 	[LUm] = FRm,
    748 	[LFr] = RFr,
    749 	[LFm] = LFm,
    750 	[LDr] = BRr,
    751 	[LDm] = BLm,
    752 	[LBr] = LBr,
    753 	[LBm] = RBm,
    754 	[FUr] = FUr,
    755 	[FUm] = FUm,
    756 	[FRr] = RUr,
    757 	[FRm] = LUm,
    758 	[FDr] = BUr,
    759 	[FDm] = BUm,
    760 	[FLr] = LUr,
    761 	[FLm] = RUm,
    762 	[BUr] = FDr,
    763 	[BUm] = FDm,
    764 	[BRr] = LDr,
    765 	[BRm] = RDm,
    766 	[BDr] = BDr,
    767 	[BDm] = BDm,
    768 	[BLr] = RDr,
    769 	[BLm] = LDm,
    770 };