aboutsummaryrefslogtreecommitdiff
path: root/src/nissy.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nissy.h')
-rw-r--r--src/nissy.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/src/nissy.h b/src/nissy.h
new file mode 100644
index 0000000..346b99a
--- /dev/null
+++ b/src/nissy.h
@@ -0,0 +1,104 @@
1/*
2If you include this file, you should also include the following:
3
4inttypes, stdarg, stdbool, string
5
6All the functions below return 0 in case of success and a positive
7number in case of error, unless otherwise specified.
8
9Arguments of type char [static 22] denote a cube in B32 format.
10Other available formats are H48 and SRC. See README.md for more info on
11these formats.
12
13Accepted moves are U, D, R, L, F and B, optionally followed by a 2,
14a ' or a 3.
15
16A transformation must be given in the format
17 (rotation|mirrored) (2 letters)
18for example 'rotation UF' or 'mirrored BL'.
19*/
20
21/* Apply the secod argument as a permutation on the first argument */
22int64_t nissy_compose(
23 const char cube[static 22],
24 const char permutation[static 22],
25 char result[static 22]
26);
27
28/* Compute the inverse of the given cube */
29int64_t nissy_inverse(
30 const char cube[static 22],
31 char result[static 22]
32);
33
34/* Apply the given sequence of moves on the given cube */
35int64_t nissy_applymoves(
36 const char cube[static 22],
37 const char *moves,
38 char result[static 22]
39);
40
41/* Apply the single given transformation to the given cube */
42int64_t nissy_applytrans(
43 const char cube[static 22],
44 const char *transformation,
45 char result[static 22]
46);
47
48/* Return the cube obtained by applying the given moves to the solved cube */
49int64_t nissy_frommoves(
50 const char *moves,
51 char result[static 22]
52);
53
54/* Convert the given cube between the two given formats */
55int64_t nissy_convert(
56 const char *format_in,
57 const char *format_out,
58 const char *cube_string,
59 char *result
60);
61
62/* Get the cube with the given ep, eo, cp and co values. */
63int64_t nissy_getcube(
64 int64_t ep,
65 int64_t eo,
66 int64_t cp,
67 int64_t co,
68 const char *options,
69 char result[static 22]
70);
71
72/*
73Returns the size of the data generated by nissy_gendata, when called with
74the same parameters, or -1 in case of error. The returned value can be
75slightly larger than the actual table size.
76*/
77int64_t nissy_datasize(
78 const char *solver,
79 const char *options /* TODO: remove options, use only solver name */
80);
81
82/* Returns the number of bytes written, or -1 in case of error */
83int64_t nissy_gendata(
84 const char *solver,
85 const char *options, /* TODO: remove options, use only solver name */
86 void *generated_data
87);
88
89/* Returns the number of solutions found, or -1 in case of error */
90int64_t nissy_solve(
91 const char cube[static 22],
92 const char *solver,
93 const char *options, /* TODO: remove options, use only solver name */
94 const char *nisstype, /* TODO: remove, use flags */
95 int8_t minmoves,
96 int8_t maxmoves,
97 int64_t maxsolutions,
98 int8_t optimal,
99 const void *data,
100 char *solutions
101);
102
103/* Set a global logger function used by this library. */
104void nissy_setlogger(void (*logger_function)(const char *, ...));

Generated with cgit - Back to sebastiano.tronto.net