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_ttrep_tests.c (844B)


      1 #include "../test.h"
      2 
      3 uint8_t inverse_trans(uint8_t);
      4 cube_t transform_corners(cube_t, uint8_t);
      5 int64_t coord_cocsep(cube_t);
      6 size_t gendata_cocsep(void *, uint64_t *, cube_t *);
      7 
      8 void run(void) {
      9 	uint8_t t;
     10 	char buf[2000000];
     11 	uint32_t *cocsepdata, tt;
     12 	uint64_t i, selfsim[COCSEP_CLASSES];
     13 	int64_t j, k, l;
     14 	cube_t rep[COCSEP_CLASSES], c, d;
     15 
     16 	gendata_cocsep(buf, selfsim, rep);
     17 	cocsepdata = (uint32_t *)((char *)buf + INFOSIZE);
     18 
     19 	for (i = 0; i < COCSEP_CLASSES; i++) {
     20 		c = rep[i];
     21 		for (t = 0; t < 48; t++) {
     22 			d = transform_corners(c, t);
     23 			j = coord_cocsep(d);
     24 			tt = TTREP(cocsepdata[j]);
     25 			d = transform_corners(d, tt);
     26 			k = coord_cocsep(d);
     27 			l = coord_cocsep(c);
     28 			if (k != l)
     29 				printf("cocsep %" PRId64 " (%" PRId64 "): "
     30 				    "%" PRId64 " ttrep %" PRIu32
     31 				    " ->  %" PRId64 "\n", i, l, j, tt, k);
     32 		}
     33 	}
     34 }