diff options
Diffstat (limited to 'src/solvers/coord')
| -rw-r--r-- | src/solvers/coord/common.h | 6 | ||||
| -rw-r--r-- | src/solvers/coord/coord.h | 1 | ||||
| -rw-r--r-- | src/solvers/coord/drslice.h | 129 | ||||
| -rw-r--r-- | src/solvers/coord/list.h | 1 |
4 files changed, 137 insertions, 0 deletions
diff --git a/src/solvers/coord/common.h b/src/solvers/coord/common.h index c512b33..d000ce9 100644 --- a/src/solvers/coord/common.h +++ b/src/solvers/coord/common.h | |||
| @@ -160,6 +160,12 @@ solution_lastqt_cw(const solution_moves_t s[static 1]) | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | STATIC bool | 162 | STATIC bool |
| 163 | solution_always_valid(const solution_moves_t s[static 1]) | ||
| 164 | { | ||
| 165 | return true; | ||
| 166 | } | ||
| 167 | |||
| 168 | STATIC bool | ||
| 163 | coord_can_switch( | 169 | coord_can_switch( |
| 164 | const coord_t coord[static 1], | 170 | const coord_t coord[static 1], |
| 165 | const unsigned char *data, | 171 | const unsigned char *data, |
diff --git a/src/solvers/coord/coord.h b/src/solvers/coord/coord.h index da93439..7716078 100644 --- a/src/solvers/coord/coord.h +++ b/src/solvers/coord/coord.h | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | #include "eo.h" | 3 | #include "eo.h" |
| 4 | #include "dr.h" | 4 | #include "dr.h" |
| 5 | #include "dreo.h" | 5 | #include "dreo.h" |
| 6 | #include "drslice.h" | ||
| 6 | #include "list.h" | 7 | #include "list.h" |
| 7 | #include "utils.h" | 8 | #include "utils.h" |
| 8 | #include "gendata.h" | 9 | #include "gendata.h" |
diff --git a/src/solvers/coord/drslice.h b/src/solvers/coord/drslice.h new file mode 100644 index 0000000..63aaa88 --- /dev/null +++ b/src/solvers/coord/drslice.h | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | #define CLASSES_CP_16 2768 | ||
| 2 | |||
| 3 | STATIC uint64_t coordinate_cp_coord(cube_t); | ||
| 4 | STATIC cube_t coordinate_cp_cube(uint64_t); | ||
| 5 | STATIC uint64_t coordinate_epud_coord(cube_t); | ||
| 6 | STATIC cube_t coordinate_epud_cube(uint64_t); | ||
| 7 | STATIC cube_t coordinate_drslice_merge(cube_t, cube_t); | ||
| 8 | |||
| 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 | |||
| 14 | STATIC bool is_drslice_solvable(cube_t); | ||
| 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 = MM18_DR, | ||
| 25 | .axistrans = { | ||
| 26 | [AXIS_UD] = TRANS_UFr, | ||
| 27 | [AXIS_RL] = TRANS_RFr, | ||
| 28 | [AXIS_FB] = TRANS_FDr, | ||
| 29 | }, | ||
| 30 | .is_admissible = &solution_always_valid, | ||
| 31 | .is_solvable = &is_drslice_solvable, | ||
| 32 | .pruning_distribution = { | ||
| 33 | /* TODO: copied from nissy-classic, to be verified */ | ||
| 34 | [0] = 1, | ||
| 35 | [1] = 3, | ||
| 36 | [2] = 10, | ||
| 37 | [3] = 52, | ||
| 38 | [4] = 285, | ||
| 39 | [5] = 1318, | ||
| 40 | [6] = 5671, | ||
| 41 | [7] = 26502, | ||
| 42 | [8] = 115467, | ||
| 43 | [9] = 470846, | ||
| 44 | [10] = 1853056, | ||
| 45 | [11] = 6535823, | ||
| 46 | [12] = 18349792, | ||
| 47 | [13] = 32843350, | ||
| 48 | [14] = 34118883, | ||
| 49 | [15] = 0, /* TODO: unknown, why does nissy-classic not have | ||
| 50 | have this value? */ | ||
| 51 | }, | ||
| 52 | .pruning_max = 15, /* TODO - either 14 or 15 */ | ||
| 53 | .sym = { | ||
| 54 | .classes = CLASSES_CP_16, | ||
| 55 | .max = FACT_8, | ||
| 56 | .coord = &coordinate_cp_coord, | ||
| 57 | .cube = &coordinate_cp_cube, | ||
| 58 | .max2 = FACT_8, | ||
| 59 | .coord2 = &coordinate_epud_coord, | ||
| 60 | .cube2 = &coordinate_epud_cube, | ||
| 61 | .merge = &coordinate_drslice_merge, | ||
| 62 | }, | ||
| 63 | }; | ||
| 64 | |||
| 65 | STATIC uint64_t | ||
| 66 | coordinate_cp_coord(cube_t c) | ||
| 67 | { | ||
| 68 | return coord_cp(c); | ||
| 69 | } | ||
| 70 | |||
| 71 | STATIC cube_t | ||
| 72 | coordinate_cp_cube(uint64_t i) | ||
| 73 | { | ||
| 74 | return invcoord_cp(i); | ||
| 75 | } | ||
| 76 | |||
| 77 | STATIC uint64_t | ||
| 78 | coordinate_epud_coord(cube_t c) | ||
| 79 | { | ||
| 80 | return coord_epud(c); | ||
| 81 | } | ||
| 82 | |||
| 83 | STATIC cube_t | ||
| 84 | coordinate_epud_cube(uint64_t i) | ||
| 85 | { | ||
| 86 | return invcoord_epud(i); | ||
| 87 | } | ||
| 88 | |||
| 89 | STATIC cube_t | ||
| 90 | coordinate_drslice_merge(cube_t c1, cube_t c2) | ||
| 91 | { | ||
| 92 | cube_t merged; | ||
| 93 | |||
| 94 | merged = c1; | ||
| 95 | copy_edges(&merged, c2); | ||
| 96 | |||
| 97 | return merged; | ||
| 98 | } | ||
| 99 | |||
| 100 | STATIC uint64_t | ||
| 101 | coordinate_drslice_coord(cube_t cube, const unsigned char *data) | ||
| 102 | { | ||
| 103 | return coord_coord_generic(&coordinate_drslice, cube, data); | ||
| 104 | } | ||
| 105 | |||
| 106 | STATIC cube_t | ||
| 107 | coordinate_drslice_cube(uint64_t i, const unsigned char *data) | ||
| 108 | { | ||
| 109 | return coord_cube_generic(&coordinate_drslice, i, data); | ||
| 110 | } | ||
| 111 | |||
| 112 | STATIC bool | ||
| 113 | coordinate_drslice_isnasty(uint64_t i, const unsigned char *data) | ||
| 114 | { | ||
| 115 | return coord_isnasty_generic(&coordinate_drslice, i, data); | ||
| 116 | } | ||
| 117 | |||
| 118 | STATIC size_t | ||
| 119 | coordinate_drslice_gendata(unsigned char *data) | ||
| 120 | { | ||
| 121 | return coord_gendata_generic(&coordinate_drslice, data); | ||
| 122 | } | ||
| 123 | |||
| 124 | STATIC bool | ||
| 125 | is_drslice_solvable(cube_t cube) { | ||
| 126 | return coord_eo(cube) == 0 && | ||
| 127 | coord_eo(transform_edges(cube, TRANS_URr)) == 0 && | ||
| 128 | coord_co(cube) == 0; | ||
| 129 | } | ||
diff --git a/src/solvers/coord/list.h b/src/solvers/coord/list.h index 9409bb6..3badc8f 100644 --- a/src/solvers/coord/list.h +++ b/src/solvers/coord/list.h | |||
| @@ -2,5 +2,6 @@ coord_t *all_coordinates[] = { | |||
| 2 | &coordinate_eo, | 2 | &coordinate_eo, |
| 3 | &coordinate_dr, | 3 | &coordinate_dr, |
| 4 | &coordinate_dreo, | 4 | &coordinate_dreo, |
| 5 | &coordinate_drslice, | ||
| 5 | NULL | 6 | NULL |
| 6 | }; | 7 | }; |
