aboutsummaryrefslogtreecommitdiff
path: root/src/cube.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-10-27 16:25:15 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2023-10-27 16:25:15 +0200
commit2a8d66906dde19ffb7315fb3f60a396a71612037 (patch)
treeaa6c340c6de7cffd65b23f93b4479b128036250b /src/cube.h
parent287f6c4067a206fb1c18eb779ef8463f06c0e5e1 (diff)
downloadnissy-core-2a8d66906dde19ffb7315fb3f60a396a71612037.tar.gz
nissy-core-2a8d66906dde19ffb7315fb3f60a396a71612037.zip
Small cleanup
Diffstat (limited to '')
-rw-r--r--src/cube.h81
1 files changed, 41 insertions, 40 deletions
diff --git a/src/cube.h b/src/cube.h
index cac6b01..1e11432 100644
--- a/src/cube.h
+++ b/src/cube.h
@@ -1,4 +1,44 @@
1/* Constants *****************************************************************/ 1/* Types *********************************************************************/
2
3/* TODO: ifdef for different implementations */
4/* See doc/CUBE_INTERNAL.md for a description of the cube format */
5typedef struct {
6 uint8_t c[8];
7 uint8_t e[12];
8} cube_t;
9
10typedef uint8_t move_t;
11typedef uint8_t trans_t;
12
13extern cube_t solvedcube;
14
15/* Functions *****************************************************************/
16
17/* Not all formats are supported for both read and write. */
18/* See doc/CUBE_TEXT.md for details. */
19typedef enum {H48, SRC} format_t;
20cube_t readcube(format_t, char *);
21void writecube(format_t, cube_t, char *);
22
23bool issolvable(cube_t);
24bool equal(cube_t, cube_t);
25bool issolved(cube_t);
26bool iserror(cube_t);
27
28int readmoves(char *, move_t *);
29void writemoves(move_t *, int, char *);
30
31trans_t readtrans(char *);
32void writetrans(trans_t, char *);
33
34cube_t move(cube_t, move_t);
35cube_t inverse(cube_t);
36cube_t compose(cube_t, cube_t);
37
38/* See doc/TRANSFORMATIONS.md for how transformations are applied */
39cube_t transform(cube_t, trans_t);
40
41/* Constants for moves and transformations ***********************************/
2 42
3/* Standard moves */ 43/* Standard moves */
4#define U 0U 44#define U 0U
@@ -76,42 +116,3 @@
76#define errormove 99U 116#define errormove 99U
77#define errortrans 99U 117#define errortrans 99U
78 118
79/* Types *********************************************************************/
80
81/* TODO: ifdef for different implementations */
82/* See doc/CUBE_INTERNAL.md for a description of the cube format */
83typedef struct {
84 uint8_t c[8];
85 uint8_t e[12];
86} cube_t;
87
88typedef uint8_t move_t;
89typedef uint8_t trans_t;
90
91extern cube_t solvedcube;
92
93/* Functions *****************************************************************/
94
95/* Not all formats are supported for both read and write. */
96/* See doc/CUBE_TEXT.md for details. */
97typedef enum {H48, SRC} format_t;
98cube_t readcube(format_t, char *);
99void writecube(format_t, cube_t, char *);
100
101bool issolvable(cube_t);
102bool equal(cube_t, cube_t);
103bool issolved(cube_t);
104bool iserror(cube_t);
105
106int readmoves(char *, move_t *);
107void writemoves(move_t *, int, char *);
108
109trans_t readtrans(char *);
110void writetrans(trans_t, char *);
111
112cube_t move(cube_t, move_t);
113cube_t inverse(cube_t);
114cube_t compose(cube_t, cube_t);
115
116/* See doc/TRANSFORMATIONS.md for how transformations are applied */
117cube_t transform(cube_t, trans_t);

Generated with cgit - Back to sebastiano.tronto.net