diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-11-11 21:37:34 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-11-11 21:37:34 +0100 |
| commit | 3568412f8f230774d0d11d7ed1c897424f95d3ef (patch) | |
| tree | 77223792d8c925a9b1fc32b3f4341e943b5f8209 /old/2021-02-18-piecefilter/src/cube.h | |
| parent | 67e1b5e6e6a2c917a2fe58a37a1382c982b1e5c5 (diff) | |
| download | nissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.tar.gz nissy-3568412f8f230774d0d11d7ed1c897424f95d3ef.zip | |
Rewritten from scratch. Welocme nissy 2.0!
Diffstat (limited to 'old/2021-02-18-piecefilter/src/cube.h')
| -rw-r--r-- | old/2021-02-18-piecefilter/src/cube.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/old/2021-02-18-piecefilter/src/cube.h b/old/2021-02-18-piecefilter/src/cube.h new file mode 100644 index 0000000..9b64a0c --- /dev/null +++ b/old/2021-02-18-piecefilter/src/cube.h | |||
| @@ -0,0 +1,45 @@ | |||
| 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 | typedef enum {U_center,D_center,R_center,L_center,F_center,B_center} Center; | ||
| 10 | typedef enum { UF, UL, UB, UR, DF, DL, DB, DR, FR, FL, BL, BR } Edge; | ||
| 11 | typedef enum { UFR, UFL, UBL, UBR, DFR, DFL, DBL, DBR } Corner; | ||
| 12 | |||
| 13 | typedef struct { | ||
| 14 | bool epose, eposs, eposm, eofb, eorl, eoud, cp, coud, cofb, corl, cpos; | ||
| 15 | } PieceFilter; | ||
| 16 | |||
| 17 | typedef struct { | ||
| 18 | uint16_t eofb, eorl, eoud, coud, cofb, corl, | ||
| 19 | epose, eposs, eposm, cp, cpos; | ||
| 20 | } Cube; | ||
| 21 | |||
| 22 | typedef struct { | ||
| 23 | int ep[12], eofb[12], eorl[12], eoud[12], | ||
| 24 | cp[8], coud[8], corl[8], cofb[8], cpos[6]; | ||
| 25 | } CubeArray; | ||
| 26 | |||
| 27 | |||
| 28 | extern PieceFilter fAll; | ||
| 29 | |||
| 30 | Cube blank_cube(); | ||
| 31 | /* Return axis (ud=0, rl=1, fb=0) of center c */ | ||
| 32 | int center_axis(int c); | ||
| 33 | /* Return slice (e=0, s=1, m=2) to which e belongs */ | ||
| 34 | int edge_slice(int e); | ||
| 35 | void cube_to_arrays(Cube cube, CubeArray *arr, PieceFilter f); | ||
| 36 | Cube arrays_to_cube(CubeArray arr, PieceFilter f); | ||
| 37 | bool equal(Cube c1, Cube c2); | ||
| 38 | bool is_solvable(Cube cube); | ||
| 39 | bool is_solved(Cube cube); | ||
| 40 | void print_cube(Cube cube); | ||
| 41 | Cube inverse_cube(Cube cube); | ||
| 42 | /* Use c2 as an alg on c1 */ | ||
| 43 | Cube compose_via_arrays(CubeArray c2, Cube c1, PieceFilter f); | ||
| 44 | |||
| 45 | #endif | ||
