nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

inverse_tests.c (477B)


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