aboutsummaryrefslogtreecommitdiff
path: root/old/2021-06-30-noreached/main.c
blob: 1ebd91717979596422015babb5c44693d83b5a64 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <stdio.h>
#include "cube.h"
#include "steps.h"

int main() {
	Alg *algo;
	AlgList *sols;
	Cube cube;
	SolveOptions opts;
	char line[1000];
	int i, ns = 2;
/*	Move m;*/
/*	int nrand = 10000, sum1, sum2, sum3;*/

	Step *stps[20]    = {&drud_HTM, &optimal_HTM};
	char sss[30][30] = {"DR on UD", "Optimal solve"};

	opts = (SolveOptions) {
		.min_moves     = 0,
		.max_moves     = 20,
		.optimal_only  = true,
		.max_solutions = 1,
		.can_niss      = false,
		.feedback      = true,
	};

	init();

/*
	srand(time(NULL));
	sum1 = 0;
	sum2 = 0;
	sum3 = 0;
	for (i = 0; i < nrand; i++) {
		cube = random_cube();
		sum1 += drud_HTM.check(cube, 20);
		sum2 += optimal_HTM.check(cube, 20);
		sum3 += cornershtreofb_HTM.check(cube, 20);
	}
	printf("Average drud pruning: %lf\n", ((double)sum1) / ((double) nrand));
	printf("Average corners htr pruning: %lf\n", ((double)sum2) / ((double) nrand));
	printf("Average corners htr + eofb pruning: %lf\n", ((double)sum3) / ((double) nrand));
*/

/*
	for (m = U; m <= B3; m++) {
		printf("Class eofbepos after %d: ", m);
		printf("%lu\n", coord_khuge.index(apply_move(m,(Cube){0})));
	}
*/

	printf("Welcome to nissy 2.0! Insert a scramble:\n");

	if (fgets(line, 1000, stdin) != NULL) {
		algo = new_alg(line);
		cube = apply_alg(algo, (Cube){0});

		print_alg(inverse_alg(algo), false);
/*
		printf("After rb_mirror:\n");
		cube = apply_trans(rb_mirror, cube);
		print_cube(cube);
		printf("Going back:\n");
		cube = apply_trans(inverse_trans(rb_mirror), cube);
*/

		print_cube(cube);

		for (i = 0; i < ns; i++) {
			sols = solve(cube, *stps[i], &opts);
			printf("%s: %d solutions found:\n", sss[i], sols->len);
			print_alglist(sols, true);
			free_alglist(sols);
		}
		free_alg(algo);
	}

	return 0;
}

Generated with cgit - Back to sebastiano.tronto.net