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

transform_tests.c (556B)


      1 #include "../test.h"
      2 
      3 cube_t applytrans(cube_t, char *);
      4 
      5 int main(void) {
      6 	char cubestr[STRLENMAX], transtr[STRLENMAX];
      7 	cube_t cube;
      8 	trans_t t;
      9 
     10 	fgets(transtr, STRLENMAX, stdin);
     11 	fgets(cubestr, STRLENMAX, stdin);
     12 	cube = cube_read("H48", cubestr);
     13 
     14 	t = cube_readtrans(transtr);
     15 	cube = cube_transform(cube, t);
     16 
     17 	if (cube_error(cube)) {
     18 		printf("Error transforming cube\n");
     19 	} else if (!cube_solvable(cube)) {
     20 		printf("Transformed cube is not solvable\n");
     21 	} else {
     22 		cube_write("H48", cube, cubestr);
     23 		printf("%s\n", cubestr);
     24 	}
     25 
     26 	return 0;
     27 }