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 (753B)


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