aboutsummaryrefslogtreecommitdiff
path: root/cube.h
diff options
context:
space:
mode:
Diffstat (limited to 'cube.h')
-rw-r--r--cube.h60
1 files changed, 2 insertions, 58 deletions
diff --git a/cube.h b/cube.h
index 77c6c21..5ef23a8 100644
--- a/cube.h
+++ b/cube.h
@@ -1,23 +1,3 @@
1/******************************************************************************
2Cube type definition
3
4Each piece is represented by an (unsigned) 8-bit integer. The 4
5least-significant bits determine which piece it is, the other 4 determine
6the orientation.
7
8Edges are numbered as follows (see also cube.c):
9UF=0 UB=1 DB=2 DF=3 UR=4 UL=5 DL=6 DR=7 FR=8 FL=9 BL=10 BR=11
10
11Corners are numbered as follows:
12UFR=0 UBL=1 DFL=2 DBR=3 UFL=4 UBR=5 DFR=6 DBL=7
13
14The orientation of the edges is with respect to F/B, the orientation of
15corners is with respect to U/D.
16
17The permutation of the center pieces is not stored. This means that the
18cube is assumed to be in a fixed orientation.
19******************************************************************************/
20
21typedef struct { 1typedef struct {
22 uint8_t corner[8]; 2 uint8_t corner[8];
23 uint8_t edge[12]; 3 uint8_t edge[12];
@@ -36,41 +16,5 @@ cube_t cube_inverse(cube_t);
36int64_t cube_coord_co(cube_t); 16int64_t cube_coord_co(cube_t);
37int64_t cube_coord_eo(cube_t); 17int64_t cube_coord_eo(cube_t);
38 18
39/****************************************************************************** 19cube_t cube_read(char *format, char *buf);
40Read / write utilities 20void cube_write(char *format, cube_t cube, char *buf);
41
42Reading and writing is not done directly via stdin / stdout, but via an
43array of char (called buf in the prototypes below).
44
45Multiple representations of the cube as text are supported:
46
47- H48: a human-readable format.
48 Each edge is represented by two letters denoting the sides it
49 belongs to and one number denoting its orientation (0 oriented, 1
50 mis-oriented). Similarly, each corner is represented by three letters and
51 a number (0 oriented, 1 twisted clockwise, 2 twisted counter-clockwise).
52
53 The solved cube looks like this:
54
55 UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0
56 UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
57
58 The cube after the moves R'U'F looks like this:
59
60 FL1 BR0 DB0 UR1 UF0 UB0 DL0 FR0 UL1 DF1 BL0 DR0
61 UBL1 DBR1 UFR2 DFR2 DFL2 UBL2 UFL2 DBL0
62
63 Whitespace (including newlines) between pieces is ignored when reading the
64 cube. A single whitespace character is added between pieces when writing.
65
66- SRC: format used to generate code for internal use.
67 If OUT is the output in SRC format, one can use `cube_t cube = OUT` to
68 declare a new cube object.
69
70- LST: a format for internal use and generating code.
71 The cube is printed as a comma-separated list of 20 integers, as they appear
72 in cube_t. Corners come first, followed by edge (unlike H48).
73******************************************************************************/
74
75cube_t readcube(char *format, char *buf);
76void writecube(char *format, cube_t cube, char *buf);

Generated with cgit - Back to sebastiano.tronto.net