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
typedef struct { uint8_t n[16]; } i128;
char *buf;
i128 rand128(void) {
uint8_t i, j;
i128 ret = {0};
for (i = 0; i < 16; i++)
for (j = 0; j < 8; j++)
ret.n[i] |= (uint8_t)(rand() % 2) << j;
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, v[13][100] = {0};
s = nissy_gendata("H48stats", "", buf);
if (s == -1) {
printf("Error generating table\n");
return;
}
for (i = 0; i < NCUBES; i++) {
nissy_gencube(rand128(), "", 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;
}
|