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

cocsep_selfsim_distribution_tests.c (794B)


      1 #include "../test.h"
      2 
      3 #define COCSEP_CLASSES 3393
      4 
      5 size_t gendata_cocsep(void *, uint64_t *, cube_t *);
      6 int64_t coord_cocsep(cube_t);
      7 
      8 int bcount(uint64_t x) {
      9 	int ret;
     10 	uint64_t i;
     11 
     12 	for (i = 0, ret = 0; i < 64; i++)
     13 		if (x & (UINT64_C(1) << i))
     14 			ret++;
     15 
     16 	return ret;
     17 }
     18 
     19 void run(void) {
     20 	uint32_t buf[300000];
     21 	int size[65], tot, j;
     22 	int64_t i;
     23 	uint64_t selfsim[COCSEP_CLASSES], sim;
     24 	cube_t rep[COCSEP_CLASSES];
     25 
     26 	memset(size, 0, 65 * sizeof(int));
     27 	gendata_cocsep(buf, selfsim, rep);
     28 
     29 	for (i = 0, tot = 0; i < COCSEP_CLASSES; i++) {
     30 		sim = selfsim[i];
     31 		if (sim >> 1)
     32 			tot++;
     33 		size[bcount(sim)]++;
     34 	}
     35 
     36 	printf("%d self-similar positions out of 3393\n", tot);
     37 	printf("Size\tnumber of groups\n");
     38 	for (j = 0; j <= 48; j++)
     39 		if (size[j] != 0)
     40 			printf("%d\t%d\n", j, size[j]);
     41 }