commit 40c1aedcd2c8b770ea07ebf7fc22e83ec4b30cb3
parent d2e83077e9bbfcb7f8b4f9506d81cc98397f2e0a
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date: Fri, 3 Dec 2021 13:41:24 +0100
Some attempts at using the inverse scramble to get more info for pruning (optimal solving)
Diffstat:
3 files changed, 32 insertions(+), 15 deletions(-)
diff --git a/nissy b/nissy
Binary files differ.
diff --git a/src/cube.c b/src/cube.c
@@ -5,7 +5,7 @@
int
array_ep_to_epos(int *ep, int *ss)
{
- int epos[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ int epos[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int eps[4];
int i, j, is;
@@ -287,11 +287,15 @@ equal(Cube c1, Cube c2)
Cube
inverse_cube(Cube cube)
{
- CubeArray *arr = new_cubearray(cube, pf_all);
- CubeArray *inv = new_cubearray((Cube){0}, pf_all);
+ CubeArray *arr, *inv;
Cube ret;
int i;
+ arr = new_cubearray((Cube){0}, pf_all);
+ inv = new_cubearray((Cube){0}, pf_all);
+
+ cube_to_arrays(cube, arr, pf_all);
+
for (i = 0; i < 12; i++) {
inv->ep[arr->ep[i]] = i;
inv->eofb[arr->ep[i]] = arr->eofb[i];
@@ -317,8 +321,8 @@ inverse_cube(Cube cube)
}
bool
-is_admissible(Cube cube)
-{
+is_admissible(Cube cube) {
+
/* TODO: this should check consistency of different orientations */
/* check also that centers are opposite and admissible */
diff --git a/src/steps.c b/src/steps.c
@@ -979,29 +979,42 @@ static int
estimate_optimal_HTM(CubeTarget ct)
{
int dr1, dr2, dr3, cor, ret;
- Cube cube = ct.cube;
+ Cube inv;
- dr1 = ptableval(&pd_khuge_HTM, cube);
+ dr1 = ptableval(&pd_khuge_HTM, ct.cube);
cor = estimate_corners_HTM(ct);
ret = MAX(dr1, cor);
-
if (ret > ct.target)
return ret;
- cube = apply_trans(rf, ct.cube);
- dr2 = ptableval(&pd_khuge_HTM, cube);
+ dr2 = ptableval(&pd_khuge_HTM, apply_trans(rf, ct.cube));
ret = MAX(ret, dr2);
-
if (ret > ct.target)
return ret;
- cube = apply_trans(fd, ct.cube);
- dr3 = ptableval(&pd_khuge_HTM, cube);
-
- /* Michiel de Bondt's trick */
+ dr3 = ptableval(&pd_khuge_HTM, apply_trans(fd, ct.cube));
if (dr1 == dr2 && dr2 == dr3 && dr1 != 0)
dr3++;
+ ret = MAX(ret, dr3);
+ if (ret > ct.target || ret == 0)
+ return ret;
+ /* Inverse cube probing */
+
+ inv = inverse_cube(ct.cube);
+ dr1 = ptableval(&pd_khuge_HTM, inv);
+ ret = MAX(ret, dr1);
+ if (ret > ct.target)
+ return ret;
+
+ dr2 = ptableval(&pd_khuge_HTM, apply_trans(rf, inv));
+ ret = MAX(ret, dr2);
+ if (ret > ct.target)
+ return ret;
+
+ dr3 = ptableval(&pd_khuge_HTM, apply_trans(fd, inv));
+ if (dr1 == dr2 && dr2 == dr3 && dr1 != 0)
+ dr3++;
return MAX(ret, dr3);
}