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

io_H48_tests.c (415B)


      1 #include "../test.h"
      2 
      3 void run(void) {
      4 	char str[STRLENMAX], *aux;
      5 	cube_t cube;
      6 
      7 	aux = str;
      8 	while (fgets(aux, STRLENMAX, stdin) != NULL)
      9 		while (*aux != '\n')
     10 			aux++;
     11 
     12 	cube = readcube("H48", str);
     13 
     14 	if (iserror(cube)) {
     15 		printf("Error reading cube\n");
     16 	} else if (!issolvable(cube)) {
     17 		printf("Cube is not solvable\n");
     18 	} else {
     19 		writecube("H48", cube, NISSY_SIZE_H48, str);
     20 		printf("%s\n", str);
     21 	}
     22 }