aboutsummaryrefslogtreecommitdiff
path: root/src/cube.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cube.h')
-rw-r--r--src/cube.h51
1 files changed, 6 insertions, 45 deletions
diff --git a/src/cube.h b/src/cube.h
index e5434e3..fcc76dc 100644
--- a/src/cube.h
+++ b/src/cube.h
@@ -1,52 +1,13 @@
1typedef enum { 1/* TODO: ifdef for different implementations */
2 U = 0, U2, U3, D, D2, D3, 2#include "cube_array.h"
3 R, R2, R3, L, L2, L3,
4 F, F2, F3, B, B2, B3
5} move_t;
6 3
7typedef enum { 4/* For moves and transformations, see constants.h */
8 UF_i = 0, UL_i, UB_i, UR_i, DF_i, DL_i, DB_i, DR_i, 5typedef uint8_t move_t;
9 UF_m, UL_m, UB_m, UR_m, DF_m, DL_m, DB_m, DR_m, 6typedef uint8_t trans_t;
10 RU_i, RF_i, RD_i, RB_i, LU_i, LF_i, LD_i, LB_i,
11 RU_m, RF_m, RD_m, RB_m, LU_m, LF_m, LD_m, LB_m,
12 FU_i, FR_i, FD_i, FL_i, BU_i, BR_i, BD_i, BL_i,
13 FU_m, FR_m, FD_m, FL_m, BU_m, BR_m, BD_m, BL_m
14} trans_t;
15
16typedef struct {
17 uint8_t c[8];
18 uint8_t e[12];
19} cube_t;
20 7
21extern cube_t solvedcube; 8extern cube_t solvedcube;
22 9
23/* 10/* For the textual representation of the cube, see utils/FORMAT.txt */
24The functions readcube() and writecube() use the following format.
25
26Each edge is represented by two letters denoting the sides it belongs to
27and one number denoting its orientation (0 oriented, 1 mis-oriented).
28Similarly, each corner is represented by three letters and a number
29(0 oriented, 1 twisted clockwise, 2 twisted counter-clockwise).
30Edge orientation is relative to the F / B axis, corner orientation is
31relative to the U / D axis.
32
33The pieces are ordered such that the solved cube looks like this:
34
35UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0
36UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
37
38Whitespace (including newlines) between pieces is ignored when reading
39the cube, and a single whitespace character is added between pieces
40when writing.
41
42The cube after the moves R'U'F looks like this:
43
44FL1 BR0 DB0 UR1 UF0 UB0 DL0 FR0 UL1 DF1 BL0 DR0
45UBL1 DBR1 UFR2 DFR2 DFL2 UBL2 UFL2 DBL0
46
47More formats might be supported in the future.
48*/
49
50cube_t readcube(char *); 11cube_t readcube(char *);
51void writecube(cube_t, char *); 12void writecube(cube_t, char *);
52 13

Generated with cgit - Back to sebastiano.tronto.net