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


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