aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--nissy-2.0beta1.tar.gzbin50332 -> 0 bytes
-rw-r--r--nissy-2.0beta2.tar.gzbin0 -> 51282 bytes
-rw-r--r--src/coord.c41
-rw-r--r--src/cube.c19
-rw-r--r--src/cube.h1
-rw-r--r--src/pruning.c1
7 files changed, 44 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index dbd6947..1e4d1c6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
1# See LICENSE file for copyright and license details. 1# See LICENSE file for copyright and license details.
2 2
3VERSION = 2.0beta1 3VERSION = 2.0beta2
4 4
5PREFIX = /usr/local 5PREFIX = /usr/local
6MANPREFIX = ${PREFIX}/share/man 6MANPREFIX = ${PREFIX}/share/man
diff --git a/nissy-2.0beta1.tar.gz b/nissy-2.0beta1.tar.gz
deleted file mode 100644
index 8fa9731..0000000
--- a/nissy-2.0beta1.tar.gz
+++ /dev/null
Binary files differ
diff --git a/nissy-2.0beta2.tar.gz b/nissy-2.0beta2.tar.gz
new file mode 100644
index 0000000..0f8abb6
--- /dev/null
+++ b/nissy-2.0beta2.tar.gz
Binary files differ
diff --git a/src/coord.c b/src/coord.c
index 059a7a2..3d5e785 100644
--- a/src/coord.c
+++ b/src/coord.c
@@ -327,9 +327,27 @@ antindex_htr_drud(uint64_t ind)
327 /* The returned cube is NOT consistent: corl and cofb can be wrong */ 327 /* The returned cube is NOT consistent: corl and cofb can be wrong */
328 /* (see cphtr) and eposm can be wrong too (not epose because dr). */ 328 /* (see cphtr) and eposm can be wrong too (not epose because dr). */
329 Cube ret = {0}; 329 Cube ret = {0};
330 static bool initialized = false;
331 static int aux[BINOM8ON4], ep[12], ep2[12];
332 static int eps_solved[4] = {UL, UR, DL, DR};
333 unsigned int i, j, k;
334
335 if (!initialized) {
336 for (i = 0; i < BINOM8ON4; i++) {
337 for (j = 0; j < 12; j++)
338 ep[j] = ep2[j] = 0;
339 index_to_subset(i, 8, 4, ep);
340 for (j = 0, k = 0; j < 8; j++)
341 ep2[j] = ep[j/2+4*(j%2)] ? eps_solved[k++] : 0;
342 aux[i] = array_ep_to_epos(ep2, eps_solved);
343 }
344
345 initialized = true;
346 }
330 347
331 ret = antindex_cphtr(ind / BINOM8ON4); 348 ret = antindex_cphtr(ind / BINOM8ON4);
332 ret.eposs = (ind % BINOM8ON4) * FACTORIAL4; 349 ret.epose = 0;
350 ret.eposs = aux[ind % BINOM8ON4];
333 351
334 return ret; 352 return ret;
335} 353}
@@ -437,8 +455,25 @@ index_drud_eofb(Cube cube)
437static uint64_t 455static uint64_t
438index_htr_drud(Cube cube) 456index_htr_drud(Cube cube)
439{ 457{
440 return index_cphtr(cube) * BINOM8ON4 + 458 static bool initialized = false;
441 (cube.eposs / FACTORIAL4) % BINOM8ON4; 459 static int aux[BINOM12ON4], ep[12], ep2[12];
460 static int eps_solved[4] = {UL, UR, DL, DR};
461 unsigned int i, j;
462
463 if (!initialized) {
464 for (i = 0; i < BINOM12ON4; i++) {
465 for (j = 0; j < 12; j++)
466 ep[j] = ep2[j] = 0;
467 epos_to_partial_ep(i*24, ep, eps_solved);
468 for (j = 0; j < 8; j++)
469 ep2[j/2 + 4*(j%2)] = ep[j] ? 1 : 0;
470 aux[i] = subset_to_index(ep2, 8, 4);
471 }
472
473 initialized = true;
474 }
475
476 return index_cphtr(cube) * BINOM8ON4 + aux[cube.eposs/24];
442} 477}
443 478
444static uint64_t 479static uint64_t
diff --git a/src/cube.c b/src/cube.c
index 06c8b8c..056e571 100644
--- a/src/cube.c
+++ b/src/cube.c
@@ -1,13 +1,8 @@
1#include "cube.h" 1#include "cube.h"
2 2
3/* Local functions **********************************************************/ 3/* Public functions implementation *******************************************/
4
5static int array_ep_to_epos(int *ep, int *eps_solved);
6static int epos_from_arrays(int *epos, int *ep);
7
8/* Local functions implementation ********************************************/
9 4
10static int 5int
11array_ep_to_epos(int *ep, int *ss) 6array_ep_to_epos(int *ep, int *ss)
12{ 7{
13 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 };
@@ -26,17 +21,9 @@ array_ep_to_epos(int *ep, int *ss)
26 for (i = 0; i < 4; i++) 21 for (i = 0; i < 4; i++)
27 swap(&epos[ss[i]], &epos[i+8]); 22 swap(&epos[ss[i]], &epos[i+8]);
28 23
29 return epos_from_arrays(epos, eps); 24 return 24 * subset_to_index(epos, 12, 4) + perm_to_index(eps, 4);
30} 25}
31 26
32static int
33epos_from_arrays(int *epos, int *ep)
34{
35 return FACTORIAL4 * subset_to_index(epos,12,4) + perm_to_index(ep,4);
36}
37
38/* Public functions implementation *******************************************/
39
40Cube 27Cube
41arrays_to_cube(CubeArray *arr, PieceFilter f) 28arrays_to_cube(CubeArray *arr, PieceFilter f)
42{ 29{
diff --git a/src/cube.h b/src/cube.h
index d1c5bfc..6c70e99 100644
--- a/src/cube.h
+++ b/src/cube.h
@@ -8,6 +8,7 @@
8#include "utils.h" 8#include "utils.h"
9 9
10Cube admissible_ep(Cube cube, PieceFilter f); 10Cube admissible_ep(Cube cube, PieceFilter f);
11int array_ep_to_epos(int *ep, int *eps_solved);
11Cube arrays_to_cube(CubeArray *arr, PieceFilter f); 12Cube arrays_to_cube(CubeArray *arr, PieceFilter f);
12Cube compose(Cube c2, Cube c1); /* Use c2 as an alg on c1 */ 13Cube compose(Cube c2, Cube c1); /* Use c2 as an alg on c1 */
13Cube compose_filtered(Cube c2, Cube c1, PieceFilter f); 14Cube compose_filtered(Cube c2, Cube c1, PieceFilter f);
diff --git a/src/pruning.c b/src/pruning.c
index ca6f57a..6165e71 100644
--- a/src/pruning.c
+++ b/src/pruning.c
@@ -178,6 +178,7 @@ genptable(PruneData *pd)
178 d+1, pd->n - oldn, pd->n, pd->coord->max); 178 d+1, pd->n - oldn, pd->n, pd->coord->max);
179 oldn = pd->n; 179 oldn = pd->n;
180 } 180 }
181 fprintf(stderr, "Pruning table generated!\n");
181 182
182 if (!write_ptable_file(pd)) 183 if (!write_ptable_file(pd))
183 fprintf(stderr, "Error writing ptable file\n"); 184 fprintf(stderr, "Error writing ptable file\n");

Generated with cgit - Back to sebastiano.tronto.net