aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-11-23 16:16:31 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2025-11-24 16:32:11 +0100
commit147b0c3c4615c32478a4923242909b8ae5a30d03 (patch)
tree5294d9b3655031535085a5163c2c5b5cbe7413b1 /test
parent78ec0d22d927bc4287aa090469d5ba5f84e8780b (diff)
downloadnissy-core-147b0c3c4615c32478a4923242909b8ae5a30d03.tar.gz
nissy-core-147b0c3c4615c32478a4923242909b8ae5a30d03.zip
Fix duplicate solutions, overflow in maxsols and improve symmetry reduction for H48.
This commit fixes two bugs: - A bug that caused duplicates solutions for symmetric scrambles. - An overflow in the maxsols parameter for the H48 solver, which caused it to find much fewer solutions than existed. Moreover, the H48 solvers has been improved by reducing by symmetry not only from the starting position, but also up to the first 4 moves.
Diffstat (limited to 'test')
-rw-r--r--test/140_appendsolution/00_empty.in1
-rw-r--r--test/140_appendsolution/01_simple_onlynormal_nounniss.in1
-rw-r--r--test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.in1
-rw-r--r--test/140_appendsolution/03_simple_unniss.in1
-rw-r--r--test/140_appendsolution/04_niss_nounniss.in1
-rw-r--r--test/140_appendsolution/05_sort_parallel.in1
-rw-r--r--test/140_appendsolution/06_unniss_trans_sort.in1
-rw-r--r--test/140_appendsolution/07_unniss_cancel_nosol.in1
-rw-r--r--test/140_appendsolution/08_unniss_cancel_nosol_v2.in1
-rw-r--r--test/140_appendsolution/09_fullinverse_niss.in1
-rw-r--r--test/140_appendsolution/10_rotated.in1
-rw-r--r--test/140_appendsolution/11_multisym.in10
-rw-r--r--test/140_appendsolution/11_multisym.out7
-rw-r--r--test/140_appendsolution/appendsolution_tests.c26
14 files changed, 45 insertions, 9 deletions
diff --git a/test/140_appendsolution/00_empty.in b/test/140_appendsolution/00_empty.in
index 1100b95..00546ef 100644
--- a/test/140_appendsolution/00_empty.in
+++ b/test/140_appendsolution/00_empty.in
@@ -1,5 +1,6 @@
1 1
20 20
31 31
41
4rotation UF 5rotation UF
50 60
diff --git a/test/140_appendsolution/01_simple_onlynormal_nounniss.in b/test/140_appendsolution/01_simple_onlynormal_nounniss.in
index fb1eaed..84d16c0 100644
--- a/test/140_appendsolution/01_simple_onlynormal_nounniss.in
+++ b/test/140_appendsolution/01_simple_onlynormal_nounniss.in
@@ -1,5 +1,6 @@
1U F R D2 B' 1U F R D2 B'
20 20
31 31
41
4rotation UF 5rotation UF
50 60
diff --git a/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.in b/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.in
index db5f074..15ff39e 100644
--- a/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.in
+++ b/test/140_appendsolution/02_simple_onlynormal_nounnis_multitrans.in
@@ -1,5 +1,6 @@
1U F R 1U F R
20 20
31
34 44
4rotation UF 5rotation UF
5mirrored UR 6mirrored UR
diff --git a/test/140_appendsolution/03_simple_unniss.in b/test/140_appendsolution/03_simple_unniss.in
index 2c5a331..ac6fe72 100644
--- a/test/140_appendsolution/03_simple_unniss.in
+++ b/test/140_appendsolution/03_simple_unniss.in
@@ -1,5 +1,6 @@
1U F B2 (R' F D) 1U F B2 (R' F D)
21 21
31 31
41
4rotation UF 5rotation UF
50 60
diff --git a/test/140_appendsolution/04_niss_nounniss.in b/test/140_appendsolution/04_niss_nounniss.in
index b07f970..cae1328 100644
--- a/test/140_appendsolution/04_niss_nounniss.in
+++ b/test/140_appendsolution/04_niss_nounniss.in
@@ -1,5 +1,6 @@
1U F B2 (R' F D) 1U F B2 (R' F D)
20 20
31 31
41
4rotation UF 5rotation UF
50 60
diff --git a/test/140_appendsolution/05_sort_parallel.in b/test/140_appendsolution/05_sort_parallel.in
index bc1cf0f..85351b5 100644
--- a/test/140_appendsolution/05_sort_parallel.in
+++ b/test/140_appendsolution/05_sort_parallel.in
@@ -1,5 +1,6 @@
1L R' B2 F 1L R' B2 F
20 20
31 31
41
4rotation UF 5rotation UF
50 60
diff --git a/test/140_appendsolution/06_unniss_trans_sort.in b/test/140_appendsolution/06_unniss_trans_sort.in
index 2ffab93..e6b7897 100644
--- a/test/140_appendsolution/06_unniss_trans_sort.in
+++ b/test/140_appendsolution/06_unniss_trans_sort.in
@@ -1,5 +1,6 @@
1B (R2 F2) 1B (R2 F2)
21 21
31 31
41
4rotation UR 5rotation UR
50 60
diff --git a/test/140_appendsolution/07_unniss_cancel_nosol.in b/test/140_appendsolution/07_unniss_cancel_nosol.in
index 6883d05..4faed6b 100644
--- a/test/140_appendsolution/07_unniss_cancel_nosol.in
+++ b/test/140_appendsolution/07_unniss_cancel_nosol.in
@@ -1,5 +1,6 @@
1B' F (R2 B2) 1B' F (R2 B2)
21 21
31 31
41
4rotation UF 5rotation UF
50 60
diff --git a/test/140_appendsolution/08_unniss_cancel_nosol_v2.in b/test/140_appendsolution/08_unniss_cancel_nosol_v2.in
index 3d461f0..741687a 100644
--- a/test/140_appendsolution/08_unniss_cancel_nosol_v2.in
+++ b/test/140_appendsolution/08_unniss_cancel_nosol_v2.in
@@ -1,5 +1,6 @@
1F' B (R2 F2) 1F' B (R2 F2)
21 21
31 31
41
4rotation UF 5rotation UF
50 60
diff --git a/test/140_appendsolution/09_fullinverse_niss.in b/test/140_appendsolution/09_fullinverse_niss.in
index bb2b640..e2e5f7b 100644
--- a/test/140_appendsolution/09_fullinverse_niss.in
+++ b/test/140_appendsolution/09_fullinverse_niss.in
@@ -1,5 +1,6 @@
1(F) 1(F)
20 20
31 31
41
4rotation UF 5rotation UF
50 60
diff --git a/test/140_appendsolution/10_rotated.in b/test/140_appendsolution/10_rotated.in
index 5210cd5..947696f 100644
--- a/test/140_appendsolution/10_rotated.in
+++ b/test/140_appendsolution/10_rotated.in
@@ -1,5 +1,6 @@
1U2 F B L' 1U2 F B L'
21 21
31 31
41
4rotation UF 5rotation UF
57 67
diff --git a/test/140_appendsolution/11_multisym.in b/test/140_appendsolution/11_multisym.in
new file mode 100644
index 0000000..947127f
--- /dev/null
+++ b/test/140_appendsolution/11_multisym.in
@@ -0,0 +1,10 @@
1L U F
20
32
42
5rotation UF
6rotation UB
72
8rotation UF
9rotation DR
100
diff --git a/test/140_appendsolution/11_multisym.out b/test/140_appendsolution/11_multisym.out
new file mode 100644
index 0000000..9f1a312
--- /dev/null
+++ b/test/140_appendsolution/11_multisym.out
@@ -0,0 +1,7 @@
1L U F
2L D R
3R U B
4R D L
5Number of solutions: 4
6Shortest solution length: 3
7Used bytes: 24
diff --git a/test/140_appendsolution/appendsolution_tests.c b/test/140_appendsolution/appendsolution_tests.c
index d4c2a1f..f9620ab 100644
--- a/test/140_appendsolution/appendsolution_tests.c
+++ b/test/140_appendsolution/appendsolution_tests.c
@@ -3,8 +3,10 @@ Input format for appendsolution tests:
3 3
4moves on normal (with NISS notation) 4moves on normal (with NISS notation)
5unniss flag (0=false, 1=true) 5unniss flag (0=false, 1=true)
6number of transformations 6n = maximum number of moves for transformations + 1 (at most 20)
7transformations, one per line 7n times the following:
8 number of transformations
9 transformations, one per line
8the orientation of the cube, as a number from 0 to 23 10the orientation of the cube, as a number from 0 to 23
9 11
10See below for the output format. 12See below for the output format.
@@ -18,11 +20,13 @@ int64_t readmoves(const char *, size_t n, size_t m,
18void solution_moves_reset(solution_moves_t [static 1]); 20void solution_moves_reset(solution_moves_t [static 1]);
19bool solution_list_init(solution_list_t [static 1], size_t n, char [n]); 21bool solution_list_init(solution_list_t [static 1], size_t n, char [n]);
20int64_t appendsolution(const solution_moves_t [static 1], 22int64_t appendsolution(const solution_moves_t [static 1],
21 const solution_settings_t [static 1], solution_list_t [static 1]); 23 size_t, const uint64_t *, const solution_settings_t [static 1],
24 solution_list_t [static 1]);
22 25
23void run(void) { 26void run(void) {
24 int i, ntrans; 27 int i, j, nnt, ntrans;
25 int64_t tot; 28 int64_t tot;
29 uint64_t tmask[20];
26 size_t nm, np; 30 size_t nm, np;
27 char str[STRLENMAX], buf[STRLENMAX]; 31 char str[STRLENMAX], buf[STRLENMAX];
28 solution_moves_t moves; 32 solution_moves_t moves;
@@ -32,7 +36,6 @@ void run(void) {
32 solution_moves_reset(&moves); 36 solution_moves_reset(&moves);
33 solution_list_init(&list, STRLENMAX, buf); 37 solution_list_init(&list, STRLENMAX, buf);
34 settings = (solution_settings_t) { 38 settings = (solution_settings_t) {
35 .tmask = UINT64_C(0),
36 .unniss = false, 39 .unniss = false,
37 .maxmoves = 20, 40 .maxmoves = 20,
38 .maxsolutions = 100, 41 .maxsolutions = 100,
@@ -49,16 +52,21 @@ void run(void) {
49 moves.npremoves = np; 52 moves.npremoves = np;
50 fgets(str, STRLENMAX, stdin); 53 fgets(str, STRLENMAX, stdin);
51 settings.unniss = (bool)atoi(str); 54 settings.unniss = (bool)atoi(str);
55
52 fgets(str, STRLENMAX, stdin); 56 fgets(str, STRLENMAX, stdin);
53 ntrans = atoi(str); 57 nnt = atoi(str);
54 for (i = 0; i < ntrans; i++) { 58 for (j = 0; j < nnt; j++) {
55 fgets(str, STRLENMAX, stdin); 59 fgets(str, STRLENMAX, stdin);
56 settings.tmask |= UINT64_C(1) << (uint64_t)readtrans(str); 60 ntrans = atoi(str);
61 for (i = 0; i < ntrans; i++) {
62 fgets(str, STRLENMAX, stdin);
63 tmask[j] |= UINT64_C(1) << (uint64_t)readtrans(str);
64 }
57 } 65 }
58 fgets(str, STRLENMAX, stdin); 66 fgets(str, STRLENMAX, stdin);
59 settings.orientation = atoi(str); 67 settings.orientation = atoi(str);
60 68
61 appendsolution(&moves, &settings, &list); 69 appendsolution(&moves, nnt, tmask, &settings, &list);
62 70
63 printf("%s", list.buf); 71 printf("%s", list.buf);
64 printf("Number of solutions: %" PRIu64 "\n", list.nsols); 72 printf("Number of solutions: %" PRIu64 "\n", list.nsols);

Generated with cgit - Back to sebastiano.tronto.net