diff options
Diffstat (limited to 'src/solvers/coord/cornersx.h')
| -rw-r--r-- | src/solvers/coord/cornersx.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/solvers/coord/cornersx.h b/src/solvers/coord/cornersx.h new file mode 100644 index 0000000..788db8d --- /dev/null +++ b/src/solvers/coord/cornersx.h | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | STATIC bool is_cornersx_solved(uint64_t, const unsigned char *); | ||
| 2 | |||
| 3 | STATIC coord_t coordinate_cornersx = { | ||
| 4 | .name = "CORNERSX", | ||
| 5 | .coord = &coordinate_corners_coord, | ||
| 6 | .cube = &coordinate_corners_cube, | ||
| 7 | .isnasty = &coordinate_corners_isnasty, | ||
| 8 | .gendata = coordinate_corners_gendata, | ||
| 9 | .max = CLASSES_CP_48 * POW_3_7, | ||
| 10 | .trans_mask = TM_ALLTRANS, | ||
| 11 | .moves_mask_gendata = MM18_ALLMOVES, | ||
| 12 | .moves_mask_solve = MM18_URF, | ||
| 13 | .is_admissible = &solution_always_valid, | ||
| 14 | .solution_prune = NULL, | ||
| 15 | .is_solvable = &cube_true, | ||
| 16 | .is_solved = &is_cornersx_solved, | ||
| 17 | .allow_niss = false, | ||
| 18 | .pruning_distribution = { | ||
| 19 | [0] = 5, | ||
| 20 | [1] = 11, | ||
| 21 | [2] = 42, | ||
| 22 | [3] = 240, | ||
| 23 | [4] = 1115, | ||
| 24 | [5] = 5848, | ||
| 25 | [6] = 29088, | ||
| 26 | [7] = 133410, | ||
| 27 | [8] = 508020, | ||
| 28 | [9] = 1100543, | ||
| 29 | [10] = 371364, | ||
| 30 | [11] = 2322, | ||
| 31 | }, | ||
| 32 | .pruning_max = 11, | ||
| 33 | .sym = { | ||
| 34 | .classes = CLASSES_CP_48, | ||
| 35 | .max = FACT_8, | ||
| 36 | .coord = &coord_cp, | ||
| 37 | .cube = &invcoord_cp, | ||
| 38 | .max2 = POW_3_7, | ||
| 39 | .coord2 = &coord_co, | ||
| 40 | .cube2 = &invcoord_co, | ||
| 41 | .merge = &coordinate_merge_cpco, | ||
| 42 | }, | ||
| 43 | }; | ||
| 44 | |||
| 45 | STATIC bool | ||
| 46 | is_cornersx_solved(uint64_t coord, const unsigned char *data) | ||
| 47 | { | ||
| 48 | /* | ||
| 49 | TODO we use a bit of an ugly trick to check all rotated versions of | ||
| 50 | the cube. We would like to apply rotations, but our oriented_cube_t | ||
| 51 | type does not allow to do this directly (we would just be changing | ||
| 52 | the orientation field, not the cube itself). So we apply slice moves | ||
| 53 | instead. We should make this less ugly. | ||
| 54 | */ | ||
| 55 | static uint8_t mt[] = { | ||
| 56 | [MOVE_x] = MOVE_M, [MOVE_x2] = MOVE_M2, [MOVE_x3] = MOVE_M3, | ||
| 57 | [MOVE_y] = MOVE_E, [MOVE_y2] = MOVE_E2, [MOVE_y3] = MOVE_E3, | ||
| 58 | [MOVE_z] = MOVE_S3, [MOVE_z2] = MOVE_S2, [MOVE_z3] = MOVE_S | ||
| 59 | }; | ||
| 60 | |||
| 61 | uint8_t i, j; | ||
| 62 | cube_t cube; | ||
| 63 | oriented_cube_t oc; | ||
| 64 | |||
| 65 | cube = coordinate_corners_cube(coord, data); | ||
| 66 | oc.orientation = ORIENTATION_UF; | ||
| 67 | for (i = ORIENTATION_UF; i <= ORIENTATION_BL; i++) { | ||
| 68 | oc.cube = cube; | ||
| 69 | for (j = 0; orientation_moves[i][j] != UINT8_MAX; j++) | ||
| 70 | oc = move_extended(oc, mt[orientation_moves[i][j]]); | ||
| 71 | if (coordinate_corners_coord(oc.cube, data) == 0) | ||
| 72 | return true; | ||
| 73 | } | ||
| 74 | |||
| 75 | return false; | ||
| 76 | } | ||
