aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/coord/dr.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/solvers/coord/dr.h')
-rw-r--r--src/solvers/coord/dr.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/solvers/coord/dr.h b/src/solvers/coord/dr.h
index 314d4f1..3bc4c6d 100644
--- a/src/solvers/coord/dr.h
+++ b/src/solvers/coord/dr.h
@@ -1,5 +1,5 @@
1#define DREOESEP_CLASSES UINT64_C(64430) 1#define DREOESEP_CLASSES UINT64_C(64430)
2#define DREOESEP_MAX (POW_2_11 * COMB_12_4) 2#define DREOESEP_MAX (POW_2_11 * COMB_12_4)
3 3
4STATIC uint64_t coord_dreoesep_nosym(cube_t); 4STATIC uint64_t coord_dreoesep_nosym(cube_t);
5STATIC cube_t invcoord_dreoesep_nosym(uint64_t); 5STATIC cube_t invcoord_dreoesep_nosym(uint64_t);
@@ -10,6 +10,8 @@ STATIC cube_t coordinate_dr_cube(uint64_t, const void *);
10STATIC bool coordinate_dr_isnasty(uint64_t, const void *); 10STATIC bool coordinate_dr_isnasty(uint64_t, const void *);
11STATIC size_t coordinate_dr_gendata(void *); 11STATIC size_t coordinate_dr_gendata(void *);
12 12
13STATIC bool is_eoco_solvable(cube_t);
14
13/* TODO: remove the following two when all coordinates are converted to unsigned */ 15/* TODO: remove the following two when all coordinates are converted to unsigned */
14STATIC uint64_t coord_co_u(cube_t c) { return (uint64_t)coord_co(c); } 16STATIC uint64_t coord_co_u(cube_t c) { return (uint64_t)coord_co(c); }
15STATIC cube_t invcoord_co_u(uint64_t i) { return invcoord_co((int64_t)i); } 17STATIC cube_t invcoord_co_u(uint64_t i) { return invcoord_co((int64_t)i); }
@@ -29,6 +31,7 @@ STATIC coord_t coordinate_dr = {
29 [AXIS_FB] = TRANS_FDr, 31 [AXIS_FB] = TRANS_FDr,
30 }, 32 },
31 .is_admissible = &solution_lastqt_cw, 33 .is_admissible = &solution_lastqt_cw,
34 .is_solvable = &is_eoco_solvable,
32 .sym = { 35 .sym = {
33 .classes = DREOESEP_CLASSES, 36 .classes = DREOESEP_CLASSES,
34 .max = DREOESEP_MAX, 37 .max = DREOESEP_MAX,
@@ -100,3 +103,18 @@ coordinate_dr_gendata(void *data)
100{ 103{
101 return coord_gendata_generic(&coordinate_dr, data); 104 return coord_gendata_generic(&coordinate_dr, data);
102} 105}
106
107STATIC bool
108is_eoco_solvable(cube_t cube) {
109 uint8_t c[8], e[12], i, cocount, eocount;
110
111 pieces(&cube, c, e);
112
113 for (i = 0, cocount = 0; i < 8; i++)
114 cocount += (c[i] & COBITS_2) >> COSHIFT;
115
116 for (i = 0, eocount = 0; i < 12; i++)
117 eocount += (e[i] & EOBIT) >> EOSHIFT;
118
119 return cocount % 3 == 0 && eocount % 2 == 0;
120}

Generated with cgit - Back to sebastiano.tronto.net