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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
#include "cube.h"
_static int64_t write_result(cube_t, char [static 22]);
_static int64_t
write_result(cube_t cube, char result[static 22])
{
if (!isconsistent(cube)) {
writecube("B32", zero, result);
return 2;
}
writecube("B32", cube, result);
return issolvable(cube) ? 0 : 1;
}
int64_t
nissy_compose(
const char cube[static 22],
const char permutation[static 22],
char result[static 22]
)
{
cube_t c, p, res;
c = readcube("B32", cube);
p = readcube("B32", permutation);
res = compose(c, p);
return write_result(res, result);
}
int64_t
nissy_inverse(
const char cube[static 22],
char result[static 22]
)
{
cube_t c, res;
c = readcube("B32", cube);
res = inverse(c);
return write_result(res, result);
}
int64_t
nissy_applymoves(
const char cube[static 22],
const char *moves,
char result[static 22]
)
{
cube_t c, res;
c = readcube("B32", cube);
res = applymoves(c, moves);
return write_result(res, result);
}
int64_t
nissy_applytrans(
const char cube[static 22],
const char *transformation,
char result[static 22]
)
{
cube_t c, res;
c = readcube("B32", cube);
res = applytrans(c, transformation);
return write_result(res, result);
}
int64_t
nissy_frommoves(
const char *moves,
char result[static 22]
)
{
cube_t res;
res = applymoves(solved, moves);
return write_result(res, result);
}
int64_t
nissy_readcube(
const char *format,
const char *cube_string,
char result[static 22]
)
{
cube_t res;
res = readcube(format, cube_string);
return write_result(res, result);
}
int64_t
nissy_convertcube(
const char *format_in,
const char *format_out,
const char *cube_string,
char *result
)
{
cube_t c;
c = readcube(format_in, cube_string);
writecube(format_out, c, result);
return isconsistent(c) ? 0 : 2;
}
int64_t
nissy_writecube(
const char *format,
const char cube[static 22],
char *result
)
{
return nissy_convertcube("B32", format, cube, result);
}
int64_t
nissy_datasize(
const char *solver,
const char *options
)
{
/* gendata() handles a NULL *data as a "dryrun" request */
return nissy_gendata(solver, options, NULL);
}
int64_t
nissy_gendata(
const char *solver,
const char *options,
void *data
)
{
/* TODO: move gendata here? */
return gendata(solver, options, data);
}
int64_t
nissy_solve(
const char cube[static 22],
const char *solver,
const char *options,
const char *nisstype,
int8_t minmoves,
int8_t maxmoves,
int64_t maxsolutions,
int8_t optimal,
const void *data,
char *solutions
)
{
/* TODO: move solve_generic here? */
return -1;
}
|