diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-19 07:32:09 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-12-19 07:32:09 +0100 |
| commit | de04d37e8520079f5bba3b1a87d42313297543db (patch) | |
| tree | dcbf454949def970c428a9b4627ae04e0e9ad1fb /src/solvers | |
| parent | d5c60236c06e67e8da45e63843b37e5d619e9d7b (diff) | |
| download | nissy-core-de04d37e8520079f5bba3b1a87d42313297543db.tar.gz nissy-core-de04d37e8520079f5bba3b1a87d42313297543db.zip | |
Add coordinate solvers for cornersh48-corner-estimate
Diffstat (limited to 'src/solvers')
| -rw-r--r-- | src/solvers/coord/common.h | 12 | ||||
| -rw-r--r-- | src/solvers/coord/coord.h | 1 | ||||
| -rw-r--r-- | src/solvers/coord/corners.h | 72 | ||||
| -rw-r--r-- | src/solvers/coord/list.h | 1 | ||||
| -rw-r--r-- | src/solvers/coord/types_macros.h | 1 | ||||
| -rw-r--r-- | src/solvers/dispatch.h | 1 | ||||
| -rw-r--r-- | src/solvers/solvers.h | 2 |
7 files changed, 89 insertions, 1 deletions
diff --git a/src/solvers/coord/common.h b/src/solvers/coord/common.h index 5f2435d..d154636 100644 --- a/src/solvers/coord/common.h +++ b/src/solvers/coord/common.h | |||
| @@ -14,6 +14,7 @@ STATIC bool coord_is_solved( | |||
| 14 | 14 | ||
| 15 | STATIC cube_t coordinate_merge_ce(cube_t, cube_t); | 15 | STATIC cube_t coordinate_merge_ce(cube_t, cube_t); |
| 16 | STATIC cube_t coordinate_merge_ec(cube_t, cube_t); | 16 | STATIC cube_t coordinate_merge_ec(cube_t, cube_t); |
| 17 | STATIC cube_t coordinate_merge_cpco(cube_t, cube_t); | ||
| 17 | 18 | ||
| 18 | STATIC uint64_t | 19 | STATIC uint64_t |
| 19 | coord_coord_generic( | 20 | coord_coord_generic( |
| @@ -215,3 +216,14 @@ coordinate_merge_ec(cube_t edges, cube_t corners) | |||
| 215 | { | 216 | { |
| 216 | return coordinate_merge_ce(corners, edges); | 217 | return coordinate_merge_ce(corners, edges); |
| 217 | } | 218 | } |
| 219 | |||
| 220 | STATIC cube_t | ||
| 221 | coordinate_merge_cpco(cube_t cp, cube_t co) | ||
| 222 | { | ||
| 223 | cube_t merged; | ||
| 224 | |||
| 225 | merged = cp; | ||
| 226 | copy_co(&merged, co); | ||
| 227 | |||
| 228 | return merged; | ||
| 229 | } | ||
diff --git a/src/solvers/coord/coord.h b/src/solvers/coord/coord.h index db40239..2ef8482 100644 --- a/src/solvers/coord/coord.h +++ b/src/solvers/coord/coord.h | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "cpepe.h" | 8 | #include "cpepe.h" |
| 9 | #include "drfin.h" | 9 | #include "drfin.h" |
| 10 | #include "htr.h" | 10 | #include "htr.h" |
| 11 | #include "corners.h" | ||
| 11 | #include "list.h" | 12 | #include "list.h" |
| 12 | #include "utils.h" | 13 | #include "utils.h" |
| 13 | #include "gendata.h" | 14 | #include "gendata.h" |
diff --git a/src/solvers/coord/corners.h b/src/solvers/coord/corners.h new file mode 100644 index 0000000..cc0d9a5 --- /dev/null +++ b/src/solvers/coord/corners.h | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | #define CLASSES_CP_48 984 | ||
| 2 | |||
| 3 | STATIC uint64_t coordinate_corners_coord(const cube_t, const unsigned char *); | ||
| 4 | STATIC cube_t coordinate_corners_cube(uint64_t, const unsigned char *); | ||
| 5 | STATIC bool coordinate_corners_isnasty(uint64_t, const unsigned char *); | ||
| 6 | STATIC size_t coordinate_corners_gendata(unsigned char *); | ||
| 7 | |||
| 8 | STATIC coord_t coordinate_corners = { | ||
| 9 | .name = "CORNERS", | ||
| 10 | .coord = &coordinate_corners_coord, | ||
| 11 | .cube = &coordinate_corners_cube, | ||
| 12 | .isnasty = &coordinate_corners_isnasty, | ||
| 13 | .gendata = coordinate_corners_gendata, | ||
| 14 | .max = CLASSES_CP_48 * POW_3_7, | ||
| 15 | .trans_mask = TM_ALLTRANS, | ||
| 16 | .moves_mask_gendata = MM18_ALLMOVES, | ||
| 17 | .moves_mask_solve = MM18_ALLMOVES, | ||
| 18 | .is_admissible = &solution_always_valid, | ||
| 19 | .solution_prune = NULL, | ||
| 20 | .is_solvable = &cube_true, | ||
| 21 | .is_solved = NULL, | ||
| 22 | .allow_niss = false, | ||
| 23 | .pruning_distribution = { | ||
| 24 | [0] = 1, | ||
| 25 | [1] = 2, | ||
| 26 | [2] = 9, | ||
| 27 | [3] = 76, | ||
| 28 | [4] = 708, | ||
| 29 | [5] = 5022, | ||
| 30 | [6] = 28248, | ||
| 31 | [7] = 132076, | ||
| 32 | [8] = 505705, | ||
| 33 | [9] = 1102421, | ||
| 34 | [10] = 375380, | ||
| 35 | [11] = 2360, | ||
| 36 | }, | ||
| 37 | .pruning_max = 11, | ||
| 38 | .sym = { | ||
| 39 | .classes = CLASSES_CP_48, | ||
| 40 | .max = FACT_8, | ||
| 41 | .coord = &coord_cp, | ||
| 42 | .cube = &invcoord_cp, | ||
| 43 | .max2 = POW_3_7, | ||
| 44 | .coord2 = &coord_co, | ||
| 45 | .cube2 = &invcoord_co, | ||
| 46 | .merge = &coordinate_merge_cpco, | ||
| 47 | }, | ||
| 48 | }; | ||
| 49 | |||
| 50 | STATIC uint64_t | ||
| 51 | coordinate_corners_coord(const cube_t cube, const unsigned char *data) | ||
| 52 | { | ||
| 53 | return coord_coord_generic(&coordinate_corners, cube, data); | ||
| 54 | } | ||
| 55 | |||
| 56 | STATIC cube_t | ||
| 57 | coordinate_corners_cube(uint64_t i, const unsigned char *data) | ||
| 58 | { | ||
| 59 | return coord_cube_generic(&coordinate_corners, i, data); | ||
| 60 | } | ||
| 61 | |||
| 62 | STATIC bool | ||
| 63 | coordinate_corners_isnasty(uint64_t i, const unsigned char *data) | ||
| 64 | { | ||
| 65 | return coord_isnasty_generic(&coordinate_corners, i, data); | ||
| 66 | } | ||
| 67 | |||
| 68 | STATIC size_t | ||
| 69 | coordinate_corners_gendata(unsigned char *data) | ||
| 70 | { | ||
| 71 | return coord_gendata_generic(&coordinate_corners, data); | ||
| 72 | } | ||
diff --git a/src/solvers/coord/list.h b/src/solvers/coord/list.h index 9b59969..f2b7368 100644 --- a/src/solvers/coord/list.h +++ b/src/solvers/coord/list.h | |||
| @@ -6,6 +6,7 @@ coord_t *all_coordinates[] = { | |||
| 6 | &coordinate_drslice, | 6 | &coordinate_drslice, |
| 7 | &coordinate_cpepe, | 7 | &coordinate_cpepe, |
| 8 | &coordinate_htr, | 8 | &coordinate_htr, |
| 9 | &coordinate_corners, | ||
| 9 | NULL | 10 | NULL |
| 10 | }; | 11 | }; |
| 11 | 12 | ||
diff --git a/src/solvers/coord/types_macros.h b/src/solvers/coord/types_macros.h index 98f9822..a9e604c 100644 --- a/src/solvers/coord/types_macros.h +++ b/src/solvers/coord/types_macros.h | |||
| @@ -30,6 +30,7 @@ typedef struct { | |||
| 30 | bool (*is_admissible)(const solution_moves_t[static 1]); | 30 | bool (*is_admissible)(const solution_moves_t[static 1]); |
| 31 | bool (*solution_prune)(const solution_moves_t[static 1]); | 31 | bool (*solution_prune)(const solution_moves_t[static 1]); |
| 32 | bool (*is_solvable)(cube_t); | 32 | bool (*is_solvable)(cube_t); |
| 33 | /* if is_solved is nulle, coord == 0 is used */ | ||
| 33 | bool (*is_solved)(uint64_t, const unsigned char *); | 34 | bool (*is_solved)(uint64_t, const unsigned char *); |
| 34 | uint64_t pruning_distribution[INFO_DISTRIBUTION_LEN]; | 35 | uint64_t pruning_distribution[INFO_DISTRIBUTION_LEN]; |
| 35 | uint8_t pruning_max; | 36 | uint8_t pruning_max; |
diff --git a/src/solvers/dispatch.h b/src/solvers/dispatch.h index 71b3947..8147929 100644 --- a/src/solvers/dispatch.h +++ b/src/solvers/dispatch.h | |||
| @@ -65,6 +65,7 @@ const char *solver_aliases[][2] = { | |||
| 65 | { "htr-drud", "coord_HTR_UF" }, | 65 | { "htr-drud", "coord_HTR_UF" }, |
| 66 | { "htr-drrl", "coord_HTR_LF" }, | 66 | { "htr-drrl", "coord_HTR_LF" }, |
| 67 | { "htr-drfb", "coord_HTR_BU" }, | 67 | { "htr-drfb", "coord_HTR_BU" }, |
| 68 | { "corners", "coord_CORNERS_UF" }, | ||
| 68 | { NULL, NULL } | 69 | { NULL, NULL } |
| 69 | }; | 70 | }; |
| 70 | 71 | ||
diff --git a/src/solvers/solvers.h b/src/solvers/solvers.h index 27ae627..e19b08a 100644 --- a/src/solvers/solvers.h +++ b/src/solvers/solvers.h | |||
| @@ -3,6 +3,6 @@ | |||
| 3 | #include "tables_types_macros.h" | 3 | #include "tables_types_macros.h" |
| 4 | #include "tables.h" | 4 | #include "tables.h" |
| 5 | #include "distribution.h" | 5 | #include "distribution.h" |
| 6 | #include "h48/h48.h" | ||
| 7 | #include "coord/coord.h" | 6 | #include "coord/coord.h" |
| 7 | #include "h48/h48.h" | ||
| 8 | #include "dispatch.h" | 8 | #include "dispatch.h" |
