diff options
| -rwxr-xr-x | nissy | bin | 320064 -> 319928 bytes | |||
| -rw-r--r-- | ptable_nxopt31_values | 17 | ||||
| -rw-r--r-- | src/alg.c | 37 | ||||
| -rw-r--r-- | src/cube.c | 7 | ||||
| -rw-r--r-- | src/solve.c | 5 | ||||
| -rw-r--r-- | src/steps.c | 30 | ||||
| -rw-r--r-- | src/steps.h | 3 | ||||
| -rw-r--r-- | src/symcoord.c | 9 | ||||
| -rw-r--r-- | src/trans.c | 2 |
9 files changed, 48 insertions, 62 deletions
| Binary files differ | |||
diff --git a/ptable_nxopt31_values b/ptable_nxopt31_values new file mode 100644 index 0000000..1e3735b --- /dev/null +++ b/ptable_nxopt31_values | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | Values for table pt_nxopt31_HTM | ||
| 2 | 0 1 | ||
| 3 | 1 6 | ||
| 4 | 2 29 | ||
| 5 | 3 164 | ||
| 6 | 4 1433 | ||
| 7 | 5 16772 | ||
| 8 | 6 205033 | ||
| 9 | 7 2513871 | ||
| 10 | 8 30329976 | ||
| 11 | 9 342440769 | ||
| 12 | 10 2815191126 | ||
| 13 | 11 6147967200 | ||
| 14 | 12 524918774 | ||
| 15 | 13 3546 | ||
| 16 | 14 0 | ||
| 17 | 15 0 | ||
| @@ -110,36 +110,25 @@ allowed_next_HTM(Move l2, Move l1, Move m) | |||
| 110 | static int | 110 | static int |
| 111 | axis(Move m) | 111 | axis(Move m) |
| 112 | { | 112 | { |
| 113 | Move i; | 113 | if (m == NULLMOVE) |
| 114 | 114 | return 0; | |
| 115 | static bool initialized = false; | ||
| 116 | static int aux[NMOVES]; | ||
| 117 | |||
| 118 | if (!initialized) { | ||
| 119 | for (i = 0; i < NMOVES; i++) { | ||
| 120 | if (i == NULLMOVE) | ||
| 121 | aux[i] = 0; | ||
| 122 | 115 | ||
| 123 | if (i >= U && i <= B3) | 116 | if (m >= U && m <= B3) |
| 124 | aux[i] = (i-1)/6 + 1; | 117 | return (m-1)/6 + 1; |
| 125 | 118 | ||
| 126 | if (i >= Uw && i <= Bw3) | 119 | if (m >= Uw && m <= Bw3) |
| 127 | aux[i] = (i-1)/6 - 2; | 120 | return (m-1)/6 - 2; |
| 128 | 121 | ||
| 129 | if (base_move(i) == E || base_move(i) == y) | 122 | if (base_move(m) == E || base_move(m) == y) |
| 130 | aux[i] = 1; | 123 | return 1; |
| 131 | 124 | ||
| 132 | if (base_move(i) == M || base_move(i) == x) | 125 | if (base_move(m) == M || base_move(m) == x) |
| 133 | aux[i] = 2; | 126 | return 2; |
| 134 | 127 | ||
| 135 | if (base_move(i) == S || base_move(i) == z) | 128 | if (base_move(m) == S || base_move(m) == z) |
| 136 | aux[i] = 3; | 129 | return 3; |
| 137 | } | ||
| 138 | |||
| 139 | initialized = true; | ||
| 140 | } | ||
| 141 | 130 | ||
| 142 | return aux[m]; | 131 | return -1; |
| 143 | } | 132 | } |
| 144 | 133 | ||
| 145 | bool | 134 | bool |
| @@ -526,11 +526,12 @@ what_center_at(Cube cube, Center c) | |||
| 526 | Corner | 526 | Corner |
| 527 | what_corner_at(Cube cube, Corner c) | 527 | what_corner_at(Cube cube, Corner c) |
| 528 | { | 528 | { |
| 529 | int i; | ||
| 530 | unsigned int ui; | ||
| 531 | CubeArray *arr; | ||
| 532 | |||
| 529 | static bool initialized = false; | 533 | static bool initialized = false; |
| 530 | static Corner aux[FACTORIAL8][8]; | 534 | static Corner aux[FACTORIAL8][8]; |
| 531 | static int i; | ||
| 532 | static unsigned int ui; | ||
| 533 | static CubeArray *arr; | ||
| 534 | 535 | ||
| 535 | if (!initialized) { | 536 | if (!initialized) { |
| 536 | for (ui = 0; ui < FACTORIAL8; ui++) { | 537 | for (ui = 0; ui < FACTORIAL8; ui++) { |
diff --git a/src/solve.c b/src/solve.c index a8f9001..ac7a22e 100644 --- a/src/solve.c +++ b/src/solve.c | |||
| @@ -264,14 +264,15 @@ instance_thread(void *arg) | |||
| 264 | darg.current_alg = new_alg(""); | 264 | darg.current_alg = new_alg(""); |
| 265 | append_move(darg.current_alg, node->alg->move[0], | 265 | append_move(darg.current_alg, node->alg->move[0], |
| 266 | node->alg->inv[0]); | 266 | node->alg->inv[0]); |
| 267 | darg.ed = new_estimatedata(); | 267 | darg.ed = malloc(sizeof(EstimateData)); |
| 268 | reset_estimatedata(darg.ed); | ||
| 268 | darg.badmoves = 0; | 269 | darg.badmoves = 0; |
| 269 | darg.badmovesinv = 0; | 270 | darg.badmovesinv = 0; |
| 270 | 271 | ||
| 271 | dfs(&darg); | 272 | dfs(&darg); |
| 272 | 273 | ||
| 273 | free_alg(darg.current_alg); | 274 | free_alg(darg.current_alg); |
| 274 | free_estimatedata(darg.ed); | 275 | free(darg.ed); |
| 275 | } | 276 | } |
| 276 | 277 | ||
| 277 | return NULL; | 278 | return NULL; |
diff --git a/src/steps.c b/src/steps.c index 014b206..933d823 100644 --- a/src/steps.c +++ b/src/steps.c | |||
| @@ -1467,12 +1467,6 @@ copy_estimatedata(EstimateData *src, EstimateData *dst) | |||
| 1467 | } | 1467 | } |
| 1468 | 1468 | ||
| 1469 | void | 1469 | void |
| 1470 | free_estimatedata(EstimateData *ed) | ||
| 1471 | { | ||
| 1472 | free(ed); | ||
| 1473 | } | ||
| 1474 | |||
| 1475 | void | ||
| 1476 | invert_estimatedata(EstimateData *ed) | 1470 | invert_estimatedata(EstimateData *ed) |
| 1477 | { | 1471 | { |
| 1478 | swap(&(ed->normal_ud), &(ed->inverse_ud)); | 1472 | swap(&(ed->normal_ud), &(ed->inverse_ud)); |
| @@ -1480,21 +1474,17 @@ invert_estimatedata(EstimateData *ed) | |||
| 1480 | swap(&(ed->normal_rl), &(ed->inverse_rl)); | 1474 | swap(&(ed->normal_rl), &(ed->inverse_rl)); |
| 1481 | } | 1475 | } |
| 1482 | 1476 | ||
| 1483 | EstimateData * | 1477 | void |
| 1484 | new_estimatedata() | 1478 | reset_estimatedata(EstimateData *ed) |
| 1485 | { | 1479 | { |
| 1486 | EstimateData *ret = malloc(sizeof(EstimateData)); | 1480 | ed->corners = -1; |
| 1487 | 1481 | ed->normal_ud = -1; | |
| 1488 | ret->corners = -1; | 1482 | ed->normal_fb = -1; |
| 1489 | ret->normal_ud = -1; | 1483 | ed->normal_rl = -1; |
| 1490 | ret->normal_fb = -1; | 1484 | ed->inverse_ud = -1; |
| 1491 | ret->normal_rl = -1; | 1485 | ed->inverse_fb = -1; |
| 1492 | ret->inverse_ud = -1; | 1486 | ed->inverse_rl = -1; |
| 1493 | ret->inverse_fb = -1; | 1487 | ed->oldret = -1; |
| 1494 | ret->inverse_rl = -1; | ||
| 1495 | ret->oldret = -1; | ||
| 1496 | |||
| 1497 | return ret; | ||
| 1498 | } | 1488 | } |
| 1499 | 1489 | ||
| 1500 | void | 1490 | void |
diff --git a/src/steps.h b/src/steps.h index a55a101..5744e48 100644 --- a/src/steps.h +++ b/src/steps.h | |||
| @@ -8,9 +8,8 @@ | |||
| 8 | extern Step * steps[NSTEPS]; | 8 | extern Step * steps[NSTEPS]; |
| 9 | 9 | ||
| 10 | void copy_estimatedata(EstimateData *s, EstimateData *d); | 10 | void copy_estimatedata(EstimateData *s, EstimateData *d); |
| 11 | void free_estimatedata(EstimateData *ed); | ||
| 12 | void invert_estimatedata(EstimateData *ed); | 11 | void invert_estimatedata(EstimateData *ed); |
| 13 | EstimateData * new_estimatedata(); | 12 | void reset_estimatedata(EstimateData *ed); |
| 14 | void prepare_step(Step *step, SolveOptions *opts); | 13 | void prepare_step(Step *step, SolveOptions *opts); |
| 15 | 14 | ||
| 16 | #endif | 15 | #endif |
diff --git a/src/symcoord.c b/src/symcoord.c index 707a84e..8b0eeb4 100644 --- a/src/symcoord.c +++ b/src/symcoord.c | |||
| @@ -352,16 +352,7 @@ gensym(SymData *sd) | |||
| 352 | 352 | ||
| 353 | for (i = 0; i < sd->coord->max; i++) { | 353 | for (i = 0; i < sd->coord->max; i++) { |
| 354 | if (sd->class[i] == sd->coord->max + 1) { | 354 | if (sd->class[i] == sd->coord->max + 1) { |
| 355 | |||
| 356 | /* | ||
| 357 | * TODO: this is the only unavoidable use of | ||
| 358 | * antindexes. I also use them in genptable() (see | ||
| 359 | * pruning.c), but there I can do without (see | ||
| 360 | * commented functions in that file. | ||
| 361 | * Removing this would allow for a great simplification | ||
| 362 | */ | ||
| 363 | c = sd->coord->cube(i); | 355 | c = sd->coord->cube(i); |
| 364 | |||
| 365 | sd->rep[nreps] = c; | 356 | sd->rep[nreps] = c; |
| 366 | for (j = 0; j < sd->ntrans; j++) { | 357 | for (j = 0; j < sd->ntrans; j++) { |
| 367 | d = apply_trans(sd->trans[j], c); | 358 | d = apply_trans(sd->trans[j], c); |
diff --git a/src/trans.c b/src/trans.c index 2946c58..72f8dd2 100644 --- a/src/trans.c +++ b/src/trans.c | |||
| @@ -25,7 +25,6 @@ static int cpos_mirror[6] = { | |||
| 25 | [F_center] = F_center, [B_center] = B_center | 25 | [F_center] = F_center, [B_center] = B_center |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | /* TODO Is there a more elegant way? */ | ||
| 29 | static char rotation_alg_string[100][NROTATIONS] = { | 28 | static char rotation_alg_string[100][NROTATIONS] = { |
| 30 | [uf] = "", [ur] = "y", [ub] = "y2", [ul] = "y3", | 29 | [uf] = "", [ur] = "y", [ub] = "y2", [ul] = "y3", |
| 31 | [df] = "z2", [dr] = "y z2", [db] = "x2", [dl] = "y3 z2", | 30 | [df] = "z2", [dr] = "y z2", [db] = "x2", [dl] = "y3 z2", |
| @@ -208,7 +207,6 @@ apply_trans(Trans t, Cube cube) | |||
| 208 | Trans | 207 | Trans |
| 209 | inverse_trans(Trans t) | 208 | inverse_trans(Trans t) |
| 210 | { | 209 | { |
| 211 | /* TODO is there a more elegant way? */ | ||
| 212 | static Trans inverse_trans_aux[NTRANS] = { | 210 | static Trans inverse_trans_aux[NTRANS] = { |
| 213 | [uf] = uf, [ur] = ul, [ul] = ur, [ub] = ub, | 211 | [uf] = uf, [ur] = ul, [ul] = ur, [ub] = ub, |
| 214 | [df] = df, [dr] = dr, [dl] = dl, [db] = db, | 212 | [df] = df, [dr] = dr, [dl] = dl, [db] = db, |
