aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cube.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/cube.h b/src/cube.h
index 28737c4..346b99a 100644
--- a/src/cube.h
+++ b/src/cube.h
@@ -1,39 +1,57 @@
1/* include: inttypes, stdarg, stdbool, string */
2
3/* 1/*
2If you include this file, you should also include the following:
3
4inttypes, stdarg, stdbool, string
5
4All the functions below return 0 in case of success and a positive 6All the functions below return 0 in case of success and a positive
5number in case of error, unless otherwise specified. See (TODO: 7number in case of error, unless otherwise specified.
6documentation) for details. 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'.
7*/ 19*/
8 20
21/* Apply the secod argument as a permutation on the first argument */
9int64_t nissy_compose( 22int64_t nissy_compose(
10 const char cube[static 22], 23 const char cube[static 22],
11 const char permutation[static 22], 24 const char permutation[static 22],
12 char result[static 22] 25 char result[static 22]
13); 26);
14 27
28/* Compute the inverse of the given cube */
15int64_t nissy_inverse( 29int64_t nissy_inverse(
16 const char cube[static 22], 30 const char cube[static 22],
17 char result[static 22] 31 char result[static 22]
18); 32);
19 33
34/* Apply the given sequence of moves on the given cube */
20int64_t nissy_applymoves( 35int64_t nissy_applymoves(
21 const char cube[static 22], 36 const char cube[static 22],
22 const char *moves, 37 const char *moves,
23 char result[static 22] 38 char result[static 22]
24); 39);
25 40
41/* Apply the single given transformation to the given cube */
26int64_t nissy_applytrans( 42int64_t nissy_applytrans(
27 const char cube[static 22], 43 const char cube[static 22],
28 const char *transformation, 44 const char *transformation,
29 char result[static 22] 45 char result[static 22]
30); 46);
31 47
48/* Return the cube obtained by applying the given moves to the solved cube */
32int64_t nissy_frommoves( 49int64_t nissy_frommoves(
33 const char *moves, 50 const char *moves,
34 char result[static 22] 51 char result[static 22]
35); 52);
36 53
54/* Convert the given cube between the two given formats */
37int64_t nissy_convert( 55int64_t nissy_convert(
38 const char *format_in, 56 const char *format_in,
39 const char *format_out, 57 const char *format_out,
@@ -41,6 +59,7 @@ int64_t nissy_convert(
41 char *result 59 char *result
42); 60);
43 61
62/* Get the cube with the given ep, eo, cp and co values. */
44int64_t nissy_getcube( 63int64_t nissy_getcube(
45 int64_t ep, 64 int64_t ep,
46 int64_t eo, 65 int64_t eo,
@@ -81,4 +100,5 @@ int64_t nissy_solve(
81 char *solutions 100 char *solutions
82); 101);
83 102
103/* Set a global logger function used by this library. */
84void nissy_setlogger(void (*logger_function)(const char *, ...)); 104void nissy_setlogger(void (*logger_function)(const char *, ...));

Generated with cgit - Back to sebastiano.tronto.net