cubecore

A library of core functions for working with 3x3x3 Rubik's cubes
git clone https://git.tronto.net/cubecore
Download | Log | Files | Refs | README | LICENSE

inverse_tests.c (392B)


      1 #include "../test.h"
      2 
      3 int main(void) {
      4 	char str[STRLENMAX];
      5 	cube_t cube, inv;
      6 
      7 	fgets(str, STRLENMAX, stdin);
      8 	cube = cube_read("H48", str);
      9 	inv = cube_inverse(cube);
     10 
     11 	if (cube_error(inv)) {
     12 		printf("Error inverting cube\n");
     13 	} else if (!cube_solvable(inv)) {
     14 		printf("Inverted cube is not solvable\n");
     15 	} else {
     16 		cube_write("H48", inv, str);
     17 		printf("%s\n", str);
     18 	}
     19 
     20 	return 0;
     21 }