aboutsummaryrefslogtreecommitdiff
path: root/test/040_inverse_cube/inverse_tests.c
blob: f0401ea12697dd80f88793c6719201e6c0302de2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "../test.h"

cube_t inverse(cube_t);

void run(void) {
	char str[STRLENMAX];
	oriented_cube_t cube, inv;

	fgets(str, STRLENMAX, stdin);
	cube = readcube(str);
	inv = (oriented_cube_t) {
		.cube = inverse(cube.cube),
		.orientation = cube.orientation
	};

	if (iserror(inv)) {
		printf("Error inverting cube\n");
	} else if (!issolvable(inv)) {
		printf("Inverted cube is not solvable\n");
	} else {
		writecube(inv, NISSY_SIZE_CUBE, str);
		printf("%s\n", str);
	}
}

Generated with cgit - Back to sebastiano.tronto.net