aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2021-12-03 13:41:24 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2021-12-03 13:41:24 +0100
commit40c1aedcd2c8b770ea07ebf7fc22e83ec4b30cb3 (patch)
treeec532ce9b7cc8df4e258b2c40cf0acfd73386422
parentd2e83077e9bbfcb7f8b4f9506d81cc98397f2e0a (diff)
downloadnissy-40c1aedcd2c8b770ea07ebf7fc22e83ec4b30cb3.tar.gz
nissy-40c1aedcd2c8b770ea07ebf7fc22e83ec4b30cb3.zip
Some attempts at using the inverse scramble to get more info for pruning (optimal solving)
-rwxr-xr-xnissybin0 -> 165008 bytes
-rw-r--r--src/cube.c14
-rw-r--r--src/steps.c33
3 files changed, 32 insertions, 15 deletions
diff --git a/nissy b/nissy
new file mode 100755
index 0000000..4623e18
--- /dev/null
+++ b/nissy
Binary files differ
diff --git a/src/cube.c b/src/cube.c
index 056e571..4e038c7 100644
--- a/src/cube.c
+++ b/src/cube.c
@@ -5,7 +5,7 @@
5int 5int
6array_ep_to_epos(int *ep, int *ss) 6array_ep_to_epos(int *ep, int *ss)
7{ 7{
8 int epos[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; 8 int epos[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
9 int eps[4]; 9 int eps[4];
10 int i, j, is; 10 int i, j, is;
11 11
@@ -287,11 +287,15 @@ equal(Cube c1, Cube c2)
287Cube 287Cube
288inverse_cube(Cube cube) 288inverse_cube(Cube cube)
289{ 289{
290 CubeArray *arr = new_cubearray(cube, pf_all); 290 CubeArray *arr, *inv;
291 CubeArray *inv = new_cubearray((Cube){0}, pf_all);
292 Cube ret; 291 Cube ret;
293 int i; 292 int i;
294 293
294 arr = new_cubearray((Cube){0}, pf_all);
295 inv = new_cubearray((Cube){0}, pf_all);
296
297 cube_to_arrays(cube, arr, pf_all);
298
295 for (i = 0; i < 12; i++) { 299 for (i = 0; i < 12; i++) {
296 inv->ep[arr->ep[i]] = i; 300 inv->ep[arr->ep[i]] = i;
297 inv->eofb[arr->ep[i]] = arr->eofb[i]; 301 inv->eofb[arr->ep[i]] = arr->eofb[i];
@@ -317,8 +321,8 @@ inverse_cube(Cube cube)
317} 321}
318 322
319bool 323bool
320is_admissible(Cube cube) 324is_admissible(Cube cube) {
321{ 325
322 /* TODO: this should check consistency of different orientations */ 326 /* TODO: this should check consistency of different orientations */
323 /* check also that centers are opposite and admissible */ 327 /* check also that centers are opposite and admissible */
324 328
diff --git a/src/steps.c b/src/steps.c
index 34ddcc2..6478bc2 100644
--- a/src/steps.c
+++ b/src/steps.c
@@ -979,29 +979,42 @@ static int
979estimate_optimal_HTM(CubeTarget ct) 979estimate_optimal_HTM(CubeTarget ct)
980{ 980{
981 int dr1, dr2, dr3, cor, ret; 981 int dr1, dr2, dr3, cor, ret;
982 Cube cube = ct.cube; 982 Cube inv;
983 983
984 dr1 = ptableval(&pd_khuge_HTM, cube); 984 dr1 = ptableval(&pd_khuge_HTM, ct.cube);
985 cor = estimate_corners_HTM(ct); 985 cor = estimate_corners_HTM(ct);
986 ret = MAX(dr1, cor); 986 ret = MAX(dr1, cor);
987
988 if (ret > ct.target) 987 if (ret > ct.target)
989 return ret; 988 return ret;
990 989
991 cube = apply_trans(rf, ct.cube); 990 dr2 = ptableval(&pd_khuge_HTM, apply_trans(rf, ct.cube));
992 dr2 = ptableval(&pd_khuge_HTM, cube);
993 ret = MAX(ret, dr2); 991 ret = MAX(ret, dr2);
994
995 if (ret > ct.target) 992 if (ret > ct.target)
996 return ret; 993 return ret;
997 994
998 cube = apply_trans(fd, ct.cube); 995 dr3 = ptableval(&pd_khuge_HTM, apply_trans(fd, ct.cube));
999 dr3 = ptableval(&pd_khuge_HTM, cube);
1000
1001 /* Michiel de Bondt's trick */
1002 if (dr1 == dr2 && dr2 == dr3 && dr1 != 0) 996 if (dr1 == dr2 && dr2 == dr3 && dr1 != 0)
1003 dr3++; 997 dr3++;
998 ret = MAX(ret, dr3);
999 if (ret > ct.target || ret == 0)
1000 return ret;
1004 1001
1002 /* Inverse cube probing */
1003
1004 inv = inverse_cube(ct.cube);
1005 dr1 = ptableval(&pd_khuge_HTM, inv);
1006 ret = MAX(ret, dr1);
1007 if (ret > ct.target)
1008 return ret;
1009
1010 dr2 = ptableval(&pd_khuge_HTM, apply_trans(rf, inv));
1011 ret = MAX(ret, dr2);
1012 if (ret > ct.target)
1013 return ret;
1014
1015 dr3 = ptableval(&pd_khuge_HTM, apply_trans(fd, inv));
1016 if (dr1 == dr2 && dr2 == dr3 && dr1 != 0)
1017 dr3++;
1005 return MAX(ret, dr3); 1018 return MAX(ret, dr3);
1006} 1019}
1007 1020

Generated with cgit - Back to sebastiano.tronto.net