nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

copy_co_tests.c (846B)


      1 #include "../test.h"
      2 
      3 void copy_co(cube_t *, cube_t);
      4 void pieces(cube_t *, uint8_t [static 8], uint8_t [static 12]);
      5 
      6 void run(void) {
      7 	char str[STRLENMAX];
      8 	oriented_cube_t cube1, cube2;
      9 	uint8_t edge[12], corner[8];
     10 
     11 	fgets(str, STRLENMAX, stdin);
     12 	cube1 = readcube(str);
     13 	fgets(str, STRLENMAX, stdin);
     14 	cube2 = readcube(str);
     15 
     16 	copy_co(&cube1.cube, cube2.cube);
     17 
     18 	if (iserror(cube1)) {
     19 		printf("Error copying CO\n");
     20 	} else if (!isconsistent(cube2)) {
     21 		pieces(&cube1.cube, corner, edge);
     22 		fprintf(stderr, "edges: ");
     23 		for (int i = 0; i < 12; i++)
     24 			fprintf(stderr, "%d ", edge[i]);
     25 		fprintf(stderr, "\n");
     26 		for (int i = 0; i < 8; i++)
     27 			fprintf(stderr, "%d ", corner[i]);
     28 		fprintf(stderr, "\n");
     29 		printf("Setting CO resulted in inconsistent cube\n");
     30 	} else {
     31 		writecube(cube1, NISSY_SIZE_CUBE, str);
     32 		printf("%s\n", str);
     33 	}
     34 }