blob: 26d12a4424d050d779ee717cfebd139e153ae82e (
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
/******************************************************************************
Section: benchmarks
Here you can find some simple functions that can be used to benchmark the
rest of the code.
******************************************************************************/
#define RANDOMCUBES 157
static void
setup_randomcubes(cube_fast_t *cubes)
{
int i;
for (i = 0; i < RANDOMCUBES; i++)
cubes[i] = run_moves(i*4);
}
cube_t
run_moves(int64_t n)
{
cube_fast_t fast;
int64_t m, i;
fast = solvedcube();
m = n / 18;
for (i = 0; i < m; i++) {
fast = _move_U(fast);
fast = _move_U2(fast);
fast = _move_U3(fast);
fast = _move_D(fast);
fast = _move_D2(fast);
fast = _move_D3(fast);
fast = _move_R(fast);
fast = _move_R2(fast);
fast = _move_R3(fast);
fast = _move_L(fast);
fast = _move_L2(fast);
fast = _move_L3(fast);
fast = _move_F(fast);
fast = _move_F2(fast);
fast = _move_F3(fast);
fast = _move_B(fast);
fast = _move_B2(fast);
fast = _move_B3(fast);
}
for (i = m * 18; i < n; i++)
fast = _move_F(fast);
return fast;
}
cube_t
run_trans(int64_t n)
{
cube_fast_t fast;
int64_t m, i;
fast = run_moves(33);
m = n / 18;
for (i = 0; i < m; i++) {
fast = _trans_UFr(fast);
fast = _trans_ULr(fast);
fast = _trans_UBr(fast);
fast = _trans_URr(fast);
fast = _trans_DFr(fast);
fast = _trans_DLr(fast);
fast = _trans_DBr(fast);
fast = _trans_DRr(fast);
fast = _trans_RUr(fast);
fast = _trans_RFr(fast);
fast = _trans_RDr(fast);
fast = _trans_RBr(fast);
fast = _trans_LUr(fast);
fast = _trans_LFr(fast);
fast = _trans_LDr(fast);
fast = _trans_LBr(fast);
fast = _trans_FUr(fast);
fast = _trans_FRr(fast);
fast = _trans_FDr(fast);
fast = _trans_FLr(fast);
fast = _trans_BUr(fast);
fast = _trans_BRr(fast);
fast = _trans_BDr(fast);
fast = _trans_BLr(fast);
fast = _trans_UFm(fast);
fast = _trans_ULm(fast);
fast = _trans_UBm(fast);
fast = _trans_URm(fast);
fast = _trans_DFm(fast);
fast = _trans_DLm(fast);
fast = _trans_DBm(fast);
fast = _trans_DRm(fast);
fast = _trans_RUm(fast);
fast = _trans_RFm(fast);
fast = _trans_RDm(fast);
fast = _trans_RBm(fast);
fast = _trans_LUm(fast);
fast = _trans_LFm(fast);
fast = _trans_LDm(fast);
fast = _trans_LBm(fast);
fast = _trans_FUm(fast);
fast = _trans_FRm(fast);
fast = _trans_FDm(fast);
fast = _trans_FLm(fast);
fast = _trans_BUm(fast);
fast = _trans_BRm(fast);
fast = _trans_BDm(fast);
fast = _trans_BLm(fast);
}
for (i = m * 18; i < n; i++)
fast = _trans_FRm(fast);
return fast;
}
cube_t
run_compose(int64_t n)
{
cube_fast_t fast, cubes[RANDOMCUBES];
int64_t i;
setup_randomcubes(cubes);
for (i = 0; i < n; i++)
fast = compose_fast(fast, cubes[i % RANDOMCUBES]);
return fast;
}
cube_t
run_inverse(int64_t n)
{
cube_fast_t fast, cubes[RANDOMCUBES];
int64_t i;
setup_randomcubes(cubes);
for (i = 0; i < n; i++)
fast = inverse_fast(cubes[i % RANDOMCUBES]);
return fast;
}
|