h48

A prototype for an optimal Rubik's cube solver, work in progress.
git clone https://git.tronto.net/h48
Download | Log | Files | Refs | README | LICENSE

commit 67c35b638c04ab7a860aac0c166936e9481633c9
parent 6c896b0e619f83b0337d20f92b14e26fcd550b42
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Mon, 15 Jul 2024 09:15:35 +0200

Added test for selfsim distribution

Diffstat:
Rtest/103_cocsep_ttrep/00_all.in -> test/103_cocsep_selfsim_distribution/00_all.in | 0
Atest/103_cocsep_selfsim_distribution/00_all.out | 12++++++++++++
Atest/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c | 41+++++++++++++++++++++++++++++++++++++++++
Rtest/103_cocsep_ttrep/00_all.out -> test/104_cocsep_ttrep/00_all.in | 0
Rtest/103_cocsep_ttrep/00_all.in -> test/104_cocsep_ttrep/00_all.out | 0
Rtest/103_cocsep_ttrep/cocsep_ttrep_tests.c -> test/104_cocsep_ttrep/cocsep_ttrep_tests.c | 0
6 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/test/103_cocsep_ttrep/00_all.in b/test/103_cocsep_selfsim_distribution/00_all.in diff --git a/test/103_cocsep_selfsim_distribution/00_all.out b/test/103_cocsep_selfsim_distribution/00_all.out @@ -0,0 +1,12 @@ +373 self-similar positions out of 3393 +Size number of groups +1 3020 +2 311 +3 8 +4 35 +6 9 +8 6 +12 1 +16 1 +24 1 +48 1 diff --git a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c @@ -0,0 +1,41 @@ +#include "../test.h" + +#define COCSEP_CLASSES 3393 + +size_t gendata_cocsep(void *, uint64_t *, cube_t *); +int64_t coord_cocsep(cube_t); + +int bcount(uint64_t x) { + int ret; + uint64_t i; + + for (i = 0, ret = 0; i < 64; i++) + if (x & (UINT64_C(1) << i)) + ret++; + + return ret; +} + +void run(void) { + uint32_t buf[300000]; + int size[65], tot, j; + int64_t i; + uint64_t selfsim[COCSEP_CLASSES], sim; + cube_t rep[COCSEP_CLASSES]; + + memset(size, 0, 65 * sizeof(int)); + gendata_cocsep(buf, selfsim, rep); + + for (i = 0, tot = 0; i < COCSEP_CLASSES; i++) { + sim = selfsim[i]; + if (sim >> 1) + tot++; + size[bcount(sim)]++; + } + + printf("%d self-similar positions out of 3393\n", tot); + printf("Size\tnumber of groups\n"); + for (j = 0; j <= 48; j++) + if (size[j] != 0) + printf("%d\t%d\n", j, size[j]); +} diff --git a/test/103_cocsep_ttrep/00_all.out b/test/104_cocsep_ttrep/00_all.in diff --git a/test/103_cocsep_ttrep/00_all.in b/test/104_cocsep_ttrep/00_all.out diff --git a/test/103_cocsep_ttrep/cocsep_ttrep_tests.c b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c