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

compose_tests.c (458B)


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