aboutsummaryrefslogtreecommitdiff
path: root/test/090_solve_simple/solve_simple_tests.c
blob: f5e00e2e1ed711d058579627ada948ac019b7b47 (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
37
38
39
40
41
42
43
44
45
46
47
48
#include "../test.h"

int64_t solve(cube_t, char *, char *, char *, int8_t, int8_t, int64_t, int8_t,
    void *, char *);

void run(void) {
	char cubestr[STRLENMAX], solverstr[STRLENMAX], optionsstr[STRLENMAX];
	char nisstypestr[STRLENMAX], minmovesstr[STRLENMAX];
	char maxmovesstr[STRLENMAX], maxsolsstr[STRLENMAX];
	char optimalstr[STRLENMAX], solutionsstr[STRLENMAX];
	cube_t cube;
	int64_t maxsols;
	int8_t minmoves, maxmoves, optimal;

	fgets(cubestr, STRLENMAX, stdin);
	fgets(solverstr, STRLENMAX, stdin);
	fgets(optionsstr, STRLENMAX, stdin);
	fgets(nisstypestr, STRLENMAX, stdin);
	fgets(minmovesstr, STRLENMAX, stdin);
	fgets(maxmovesstr, STRLENMAX, stdin);
	fgets(maxsolsstr, STRLENMAX, stdin);
	fgets(optimalstr, STRLENMAX, stdin);

	solverstr[strcspn(solverstr, "\n")] = 0;
	optionsstr[strcspn(optionsstr, "\n")] = 0;
	nisstypestr[strcspn(nisstypestr, "\n")] = 0;

	cube = readcube("H48", cubestr);
	minmoves = atoi(minmovesstr);
	maxmoves = atoi(maxmovesstr);
	maxsols = atoi(maxsolsstr);
	optimal = atoi(optimalstr);

	solve(
		cube,
		solverstr,
		optionsstr,
		nisstypestr,
		minmoves,
		maxmoves,
		maxsols,
		optimal,
		NULL,
		solutionsstr
	);

	printf("%s", solutionsstr);
}

Generated with cgit - Back to sebastiano.tronto.net