aboutsummaryrefslogtreecommitdiff
path: root/src/solvers
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-07-17 07:57:18 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-07-17 07:57:18 +0200
commit5e741a00a1350477c7d8778cb466c8efa27b152d (patch)
tree37d3ab4b00f1b735f5da3b8f0065f1f19e920678 /src/solvers
parent37dc364aaf751a14ff8c7e74e6bae59128c558df (diff)
downloadnissy-core-5e741a00a1350477c7d8778cb466c8efa27b152d.tar.gz
nissy-core-5e741a00a1350477c7d8778cb466c8efa27b152d.zip
Working drslice (same results as nissy-classic)
Diffstat (limited to '')
-rw-r--r--src/solvers/coord/common.h6
-rw-r--r--src/solvers/coord/coord.h1
-rw-r--r--src/solvers/coord/drslice.h129
-rw-r--r--src/solvers/coord/list.h1
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
162STATIC bool 162STATIC bool
163solution_always_valid(const solution_moves_t s[static 1])
164{
165 return true;
166}
167
168STATIC bool
163coord_can_switch( 169coord_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
3STATIC uint64_t coordinate_cp_coord(cube_t);
4STATIC cube_t coordinate_cp_cube(uint64_t);
5STATIC uint64_t coordinate_epud_coord(cube_t);
6STATIC cube_t coordinate_epud_cube(uint64_t);
7STATIC cube_t coordinate_drslice_merge(cube_t, cube_t);
8
9STATIC uint64_t coordinate_drslice_coord(cube_t, const unsigned char *);
10STATIC cube_t coordinate_drslice_cube(uint64_t, const unsigned char *);
11STATIC bool coordinate_drslice_isnasty(uint64_t, const unsigned char *);
12STATIC size_t coordinate_drslice_gendata(unsigned char *);
13
14STATIC bool is_drslice_solvable(cube_t);
15
16STATIC 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
65STATIC uint64_t
66coordinate_cp_coord(cube_t c)
67{
68 return coord_cp(c);
69}
70
71STATIC cube_t
72coordinate_cp_cube(uint64_t i)
73{
74 return invcoord_cp(i);
75}
76
77STATIC uint64_t
78coordinate_epud_coord(cube_t c)
79{
80 return coord_epud(c);
81}
82
83STATIC cube_t
84coordinate_epud_cube(uint64_t i)
85{
86 return invcoord_epud(i);
87}
88
89STATIC cube_t
90coordinate_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
100STATIC uint64_t
101coordinate_drslice_coord(cube_t cube, const unsigned char *data)
102{
103 return coord_coord_generic(&coordinate_drslice, cube, data);
104}
105
106STATIC cube_t
107coordinate_drslice_cube(uint64_t i, const unsigned char *data)
108{
109 return coord_cube_generic(&coordinate_drslice, i, data);
110}
111
112STATIC bool
113coordinate_drslice_isnasty(uint64_t i, const unsigned char *data)
114{
115 return coord_isnasty_generic(&coordinate_drslice, i, data);
116}
117
118STATIC size_t
119coordinate_drslice_gendata(unsigned char *data)
120{
121 return coord_gendata_generic(&coordinate_drslice, data);
122}
123
124STATIC bool
125is_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};

Generated with cgit - Back to sebastiano.tronto.net