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

inverse_tests.c (408B)


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