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

getcube_tests.c (586B)


      1 #include "../test.h"
      2 
      3 cube_t getcube(int64_t, int64_t, int64_t, int64_t);
      4 
      5 void run(void) {
      6 	char str[STRLENMAX];
      7 	cube_t cube;
      8 	int64_t ep, eo, cp, co;
      9 
     10 	fgets(str, STRLENMAX, stdin);
     11 	ep = atoll(str);
     12 	fgets(str, STRLENMAX, stdin);
     13 	eo = atoll(str);
     14 	fgets(str, STRLENMAX, stdin);
     15 	cp = atoll(str);
     16 	fgets(str, STRLENMAX, stdin);
     17 	co = atoll(str);
     18 
     19 	cube = getcube(ep, eo, cp, co);
     20 
     21 	if (iserror(cube)) {
     22 		printf("Error cube\n");
     23 	} else if (!isconsistent(cube)) {
     24 		printf("Inconsistent cube\n");
     25 	} else {
     26 		writecube("H48", cube, NISSY_SIZE_H48, str);
     27 		printf("%s\n", str);
     28 	}
     29 }