aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-08-05 17:40:15 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-08-05 17:40:15 +0200
commitdc64668ceba09cd048fb92af77857b594c584c27 (patch)
treea37f907a18f3251b3ef0a25ebe8dcb2a9f383238
parentf148aa65dfe587e7b5d2f48b5005be670788dbe6 (diff)
downloadnissy-core-dc64668ceba09cd048fb92af77857b594c584c27.tar.gz
nissy-core-dc64668ceba09cd048fb92af77857b594c584c27.zip
Comment cube.h
Diffstat (limited to '')
-rw-r--r--README.md3
-rw-r--r--TODO.txt2
-rw-r--r--src/cube.h28
3 files changed, 27 insertions, 6 deletions
diff --git a/README.md b/README.md
index fb877f0..049c31d 100644
--- a/README.md
+++ b/README.md
@@ -227,3 +227,6 @@ The cube after the move F looks like this:
227``` 227```
228MBODSFQH=ZBCYEFGHQTKL 228MBODSFQH=ZBCYEFGHQTKL
229``` 229```
230
231A cube in B32 format is always 21 characters long (22 if the terminating
232null character is included).
diff --git a/TODO.txt b/TODO.txt
index c4c49d8..68fe8a2 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,7 +1,5 @@
1# Documentation and cleanup 1# Documentation and cleanup
2 2
3- Add comments to cube.h
4 - one for each function?
5- Internal documentation 3- Internal documentation
6 - h48 solver and co 4 - h48 solver and co
7 - what is h and k 5 - what is h and k
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