aboutsummaryrefslogtreecommitdiff
path: root/test/061_inverse_trans/inverse_trans_tests.c
blob: bad39fa552f2a862de62c04231f80d26db34b569 (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
25
26
27
28
29
30
31
32
33
34
35
36
#include "../test.h"

uint8_t readtrans(char [static NISSY_SIZE_TRANSFORMATION]);
uint8_t inverse_trans(uint8_t);
oriented_cube_t applymoves(oriented_cube_t, char *);
oriented_cube_t applytrans(oriented_cube_t, char *);
extern char *transstr[];

void run(void) {
	uint8_t t, tinv;
	oriented_cube_t cube;

	for (t = 0; t < 48; t++) {
		cube = solvedcube();
		cube = applymoves(cube, "R");
		cube = applymoves(cube, "U");
		cube = applymoves(cube, "F");

		cube = applytrans(cube, transstr[t]);
		tinv = inverse_trans(t);
		cube = applytrans(cube, transstr[tinv]);

		if (iserror(cube)) {
			printf("Error transforming cube\n");
		} else if (!issolvable(cube)) {
			printf("Transformed cube is not solvable\n");
		} else {
			cube = applymoves(cube, "F'");
			cube = applymoves(cube, "U'");
			cube = applymoves(cube, "R'");
			if (!issolved(cube))
				printf("%s: Error! Got %" PRIu8 "\n",
				    transstr[t], tinv);
		}
	}
}

Generated with cgit - Back to sebastiano.tronto.net