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

compose_tests.c (451B)


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