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_transform_invariant.c (784B)


      1 #include "../test.h"
      2 
      3 size_t gendata_cocsep(void *, uint64_t *, cube_t *);
      4 cube_t transform(cube_t, uint8_t);
      5 int64_t coord_cocsep(cube_t);
      6 
      7 void run(void) {
      8 	uint8_t t;
      9 	char buf[2000000];
     10 	uint32_t *cocsepdata;
     11 	uint64_t selfsim[COCSEP_CLASSES];
     12 	int64_t coord, tcoord;
     13 	char str[STRLENMAX];
     14 	cube_t cube, transd, rep[COCSEP_CLASSES];
     15 
     16 	fgets(str, STRLENMAX, stdin);
     17 	cube = readcube("H48", str);
     18 
     19 	gendata_cocsep(buf, selfsim, rep);
     20 	cocsepdata = (uint32_t *)((char *)buf + INFOSIZE);
     21 
     22 	coord = (int64_t)COCLASS(cocsepdata[coord_cocsep(cube)]);
     23 	for (t = 0; t < 48; t++) {
     24 		transd = transform(cube, t);
     25 		tcoord = (int64_t)COCLASS(cocsepdata[coord_cocsep(transd)]);
     26 		if (coord != tcoord)
     27 			printf("Error: expected %" PRId64
     28 			    " but got %" PRId64 "\n", coord, tcoord);
     29 	}
     30 }