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
|
#include <time.h>
#include "../timerun.h"
#include "../../src/cube.h"
#define MAXMOVES 20
#define NCUBES 1000
char *buf;
uint64_t rand64(void) {
uint64_t i, ret;
for (i = 0, ret = 0; i < 64; i++)
ret |= (uint64_t)(rand() % 2) << i;
return ret;
}
void output(int64_t v[13][100]) {
/* TODO: write to file and output only cocsepdata table stats */
}
void run(void) {
uint32_t *h48info;
int i, j;
char sols[13], cube[22];
int64_t s, ep, eo, cp, co, v[13][100] = {0};
s = nissy_gendata("H48stats", "", buf);
if (s == -1) {
printf("Error generating table\n");
return;
}
for (i = 0; i < NCUBES; i++) {
ep = rand64();
eo = rand64();
cp = rand64();
co = rand64();
nissy_getcube(ep, eo, cp, co, "fix", cube);
nissy_solve(cube, "H48stats",
"", "", "", 0, MAXMOVES, 1, -1, buf, sols);
for (j = 0; j < 13; j++)
v[j][(int)sols[j]]++;
}
output(v);
}
int main() {
int64_t size;
srand(time(NULL));
size = nissy_datasize("H48", OPTIONS);
if (size == -1) {
printf("h48 stats: error in datasize\n");
return 1;
}
buf = malloc(size);
timerun(run, "h48 table stats");
free(buf);
return 0;
}
|