diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-29 16:57:21 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-30 16:10:29 +0200 |
| commit | 6cf7cd87a90a1314332aace1d25b9c0f230dc227 (patch) | |
| tree | c246fbd0d400b34e6461e88a1bb50b4812eae8e5 /src/solvers/coord/drslice.h | |
| parent | ea0387796a349c91032fbcb10f50c6ad8607b0f6 (diff) | |
| download | nissy-core-6cf7cd87a90a1314332aace1d25b9c0f230dc227.tar.gz nissy-core-6cf7cd87a90a1314332aace1d25b9c0f230dc227.zip | |
added drslice coordinate
Diffstat (limited to 'src/solvers/coord/drslice.h')
| -rw-r--r-- | src/solvers/coord/drslice.h | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/src/solvers/coord/drslice.h b/src/solvers/coord/drslice.h new file mode 100644 index 0000000..4299b30 --- /dev/null +++ b/src/solvers/coord/drslice.h | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | /* | ||
| 2 | The DRSLICE coordinate is almost identical to DRFINNOE, but it allows for | ||
| 3 | the centers of the E layer to be off by a rotation. For this reason we reuse | ||
| 4 | much of the code of DRFINNOE. We could make the pruning table 4x smaller | ||
| 5 | if we reduced the coordinate by rotations. TODO. | ||
| 6 | */ | ||
| 7 | |||
| 8 | STATIC cube_t coordinate_drslice_merge(cube_t, cube_t); | ||
| 9 | STATIC uint64_t coordinate_drslice_coord(cube_t, const unsigned char *); | ||
| 10 | STATIC cube_t coordinate_drslice_cube(uint64_t, const unsigned char *); | ||
| 11 | STATIC bool coordinate_drslice_isnasty(uint64_t, const unsigned char *); | ||
| 12 | STATIC size_t coordinate_drslice_gendata(unsigned char *); | ||
| 13 | STATIC bool is_drslice_solvable(cube_t); | ||
| 14 | STATIC bool is_drslice_solved(uint64_t, const unsigned char *); | ||
| 15 | |||
| 16 | STATIC coord_t coordinate_drslice = { | ||
| 17 | .name = "DRSLICE", | ||
| 18 | .coord = &coordinate_drslice_coord, | ||
| 19 | .cube = &coordinate_drslice_cube, | ||
| 20 | .isnasty = &coordinate_drslice_isnasty, | ||
| 21 | .gendata = coordinate_drslice_gendata, | ||
| 22 | .max = CLASSES_CP_16 * FACT_8, | ||
| 23 | .trans_mask = TM_UDFIX, | ||
| 24 | .moves_mask_gendata = MM18_DR, | ||
| 25 | .moves_mask_solve = MM18_DR_NOD, | ||
| 26 | .axistrans = { | ||
| 27 | [AXIS_UD] = TRANS_UFr, | ||
| 28 | [AXIS_RL] = TRANS_RFr, | ||
| 29 | [AXIS_FB] = TRANS_FDr, | ||
| 30 | }, | ||
| 31 | .is_admissible = &solution_always_valid, | ||
| 32 | .is_solvable = &is_drslice_solvable, | ||
| 33 | .is_solved = &is_drslice_solved, | ||
| 34 | .allow_niss = false, | ||
| 35 | .pruning_distribution = { | ||
| 36 | [0] = 3, | ||
| 37 | [1] = 7, | ||
| 38 | [2] = 18, | ||
| 39 | [3] = 111, | ||
| 40 | [4] = 433, | ||
| 41 | [5] = 1618, | ||
| 42 | [6] = 6718, | ||
| 43 | [7] = 29182, | ||
| 44 | [8] = 119873, | ||
| 45 | [9] = 476999, | ||
| 46 | [10] = 1858350, | ||
| 47 | [11] = 6531166, | ||
| 48 | [12] = 18338522, | ||
| 49 | [13] = 32839235, | ||
| 50 | [14] = 34118824, | ||
| 51 | [15] = 17284701 | ||
| 52 | }, | ||
| 53 | .pruning_max = 15, | ||
| 54 | .sym = { | ||
| 55 | .classes = CLASSES_CP_16, | ||
| 56 | .max = FACT_8, | ||
| 57 | .coord = &coord_cp, | ||
| 58 | .cube = &invcoord_cp, | ||
| 59 | .max2 = FACT_8, | ||
| 60 | .coord2 = &coord_epud, | ||
| 61 | .cube2 = &invcoord_epud, | ||
| 62 | .merge = &coordinate_drslice_merge, | ||
| 63 | }, | ||
| 64 | }; | ||
| 65 | |||
| 66 | STATIC cube_t | ||
| 67 | coordinate_drslice_merge(cube_t c1, cube_t c2) | ||
| 68 | { | ||
| 69 | cube_t merged; | ||
| 70 | |||
| 71 | merged = c1; | ||
| 72 | copy_edges(&merged, c2); | ||
| 73 | |||
| 74 | return merged; | ||
| 75 | } | ||
| 76 | |||
| 77 | STATIC uint64_t | ||
| 78 | coordinate_drslice_coord(cube_t cube, const unsigned char *data) | ||
| 79 | { | ||
| 80 | return coord_coord_generic(&coordinate_drslice, cube, data); | ||
| 81 | } | ||
| 82 | |||
| 83 | STATIC cube_t | ||
| 84 | coordinate_drslice_cube(uint64_t i, const unsigned char *data) | ||
| 85 | { | ||
| 86 | return coord_cube_generic(&coordinate_drslice, i, data); | ||
| 87 | } | ||
| 88 | |||
| 89 | STATIC size_t | ||
| 90 | coordinate_drslice_gendata(unsigned char *data) | ||
| 91 | { | ||
| 92 | return coord_gendata_generic(&coordinate_drslice, data); | ||
| 93 | } | ||
| 94 | |||
| 95 | STATIC bool | ||
| 96 | coordinate_drslice_isnasty(uint64_t i, const unsigned char *data) | ||
| 97 | { | ||
| 98 | return coord_isnasty_generic(&coordinate_drslice, i, data); | ||
| 99 | } | ||
| 100 | |||
| 101 | STATIC bool | ||
| 102 | is_drslice_solvable(cube_t cube) { | ||
| 103 | return coord_eo(cube) == 0 && | ||
| 104 | coord_eo(transform_edges(cube, TRANS_URr)) == 0 && | ||
| 105 | coord_co(cube) == 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | STATIC bool | ||
| 109 | is_drslice_solved(uint64_t i, const unsigned char *data) | ||
| 110 | { | ||
| 111 | /* Pre-computed coordinates of U D' (= U' D up to trans) and U2 D2 */ | ||
| 112 | return i == 0 || i == 109779816 || i == 68468527; | ||
| 113 | } | ||
