diff options
Diffstat (limited to '')
| -rw-r--r-- | old/2021-02-06/cube.h | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/old/2021-02-06/cube.h b/old/2021-02-06/cube.h deleted file mode 100644 index bc4f14b..0000000 --- a/old/2021-02-06/cube.h +++ /dev/null | |||
| @@ -1,60 +0,0 @@ | |||
| 1 | #ifndef CUBE_H | ||
| 2 | #define CUBE_H | ||
| 3 | |||
| 4 | #include <stdio.h> | ||
| 5 | #include <stdbool.h> | ||
| 6 | #include <stdint.h> | ||
| 7 | #include "utils.h" | ||
| 8 | |||
| 9 | #define NMOVES (z3+1) | ||
| 10 | |||
| 11 | /* Constants for moves and pieces */ | ||
| 12 | typedef enum { | ||
| 13 | NULLMOVE, | ||
| 14 | U, U2, U3, D, D2, D3, R, R2, R3, L, L2, L3, F, F2, F3, B, B2, B3, | ||
| 15 | Uw, Uw2, Uw3, Dw, Dw2, Dw3, Rw, Rw2, Rw3, | ||
| 16 | Lw, Lw2, Lw3, Fw, Fw2, Fw3, Bw, Bw2, Bw3, | ||
| 17 | M, M2, M3, S, S2, S3, E, E2, E3, | ||
| 18 | x, x2, x3, y, y2, y3, z, z2, z3, | ||
| 19 | } Move; | ||
| 20 | typedef enum {U_center,D_center,R_center,L_center,F_center,B_center} Center; | ||
| 21 | typedef enum { UF, UL, UB, UR, DF, DL, DB, DR, FR, FL, BL, BR } Edge; | ||
| 22 | typedef enum { UFR, UFL, UBL, UBR, DFR, DFL, DBL, DBR } Corner; | ||
| 23 | |||
| 24 | /* An alg is an array of "NissMoves", which can be on normal or on inverse. */ | ||
| 25 | typedef struct { bool inverse; Move m; } NissMove; | ||
| 26 | |||
| 27 | /* Representation of the cube */ | ||
| 28 | typedef struct { | ||
| 29 | uint16_t eofb, eorl, eoud, coud, cofb, corl, | ||
| 30 | epose, eposs, eposm, cp, cpos; | ||
| 31 | } Cube; | ||
| 32 | |||
| 33 | extern bool commute[NMOVES][NMOVES]; | ||
| 34 | extern bool possible_next[NMOVES][NMOVES][NMOVES]; | ||
| 35 | extern Move inverse[NMOVES]; | ||
| 36 | /* Movesets */ | ||
| 37 | extern bool standard_moveset[NMOVES]; | ||
| 38 | |||
| 39 | int copy_alg(NissMove *src, NissMove *dest); /*return number of moves copied */ | ||
| 40 | |||
| 41 | bool equal(Cube c1, Cube c2); | ||
| 42 | bool is_solvable(Cube cube); | ||
| 43 | /* reorient=true allows solved in wrong orientation */ | ||
| 44 | bool is_solved(Cube cube, bool reorient); | ||
| 45 | void print_cube(Cube cube); | ||
| 46 | void print_moves(NissMove *alg); | ||
| 47 | int read_moves(char *str, NissMove *alg, int n); /* reads at most n moves */ | ||
| 48 | void cleanup(NissMove *src, int n); /* rewrites using basic moves, at most n */ | ||
| 49 | Cube blank_cube(); | ||
| 50 | Cube inverse_cube(Cube cube); | ||
| 51 | Cube move_cube(Move m, Cube cube); | ||
| 52 | Cube compose(Cube c2, Cube c1); /* Use c2 as an alg */ | ||
| 53 | Cube apply_alg(NissMove *alg, Cube cube); | ||
| 54 | |||
| 55 | void init_ttables(bool read, bool write); | ||
| 56 | void init_aux_tables(); | ||
| 57 | |||
| 58 | void init_dbg(); | ||
| 59 | |||
| 60 | #endif | ||
