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

transform_tests.c (512B)


      1 #include "../test.h"
      2 
      3 cube_t applytrans(cube_t, char *);
      4 
      5 void run(void) {
      6 	char cubestr[STRLENMAX], transtr[STRLENMAX];
      7 	cube_t cube;
      8 
      9 	fgets(transtr, STRLENMAX, stdin);
     10 	fgets(cubestr, STRLENMAX, stdin);
     11 	cube = readcube("H48", cubestr);
     12 
     13 	cube = applytrans(cube, transtr);
     14 
     15 	if (iserror(cube)) {
     16 		printf("Error transforming cube\n");
     17 	} else if (!issolvable(cube)) {
     18 		printf("Transformed cube is not solvable\n");
     19 	} else {
     20 		writecube("H48", cube, NISSY_SIZE_H48, cubestr);
     21 		printf("%s\n", cubestr);
     22 	}
     23 }