aboutsummaryrefslogtreecommitdiff
path: root/old/2020-unknown-date/pieces.h
diff options
context:
space:
mode:
Diffstat (limited to 'old/2020-unknown-date/pieces.h')
-rw-r--r--old/2020-unknown-date/pieces.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/old/2020-unknown-date/pieces.h b/old/2020-unknown-date/pieces.h
new file mode 100644
index 0000000..dbdd740
--- /dev/null
+++ b/old/2020-unknown-date/pieces.h
@@ -0,0 +1,59 @@
1/* Moves and other things */
2
3#ifndef PIECES_H
4#define PIECES_H
5
6typedef enum {
7 U, U2, U3, D, D2, D3, R, R2, R3, L, L2, L3, F, F2, F3, B, B2, B3,
8 Uw, Uw2, Uw3, Dw, Dw2, Dw3, Rw, Rw2, Rw3,
9 Lw, Lw2, Lw3, Fw, Fw2, Fw3, Bw, Bw2, Bw3,
10 M, M2, M3, S, S2, S3, E, E2, E3,
11 X, X2, X3, Y, Y2, Y3, Z, Z2, Z3,
12 NULLMOVE
13} Move;
14typedef enum {
15 U_center, D_center, R_center, L_center, F_center, B_center
16} Center;
17typedef enum { UF, UL, UB, UR, DF, DL, DB, DR, FR, FL, BL, BR } Edge;
18typedef enum { UFR, UFL, UBL, UBR, DFR, DFL, DBL, DBR } Corner;
19
20/* Arrays for strings of pieces and moves */
21extern char edge_string[12][5];
22extern char corner_string[8][5];
23extern char center_string[6][5];
24extern char move_string[NULLMOVE+1][5];
25
26/* Three big arrays that determine the movement of edges, corners and
27 * centers for some of the basic moves. Yes, one can be much more elegant and
28 * write much fewer lines. But then things get less elegant somewhere else. */
29extern int edge_cycle[NULLMOVE+1][12];
30extern int corner_cycle[NULLMOVE+1][8];
31extern int center_cycle[NULLMOVE+1][6];
32
33/* Representation of the cube */
34typedef struct {
35 /* Edge orientation */
36 int eofb;
37 int eorl;
38 int eoud;
39
40 /* Corner orientation */
41 int coud;
42 int cofb;
43 int corl;
44
45 /* Position of M/E/S slice edges */
46 /* TODO: keep in mind that the 4! positions with edges in correct slice
47 * must be the first 4! indeces */
48 int epose;
49 int eposs;
50 int eposm;
51
52 /* Permutation of corners */
53 int cp;
54
55 /* Position of centers */
56 int centerpos;
57} Cube;
58
59#endif

Generated with cgit - Back to sebastiano.tronto.net