diff options
Diffstat (limited to '')
| -rw-r--r-- | src/cube.h | 28 |
1 files changed, 15 insertions, 13 deletions
| @@ -1,43 +1,45 @@ | |||
| 1 | /* Types *********************************************************************/ | 1 | /* Types *********************************************************************/ |
| 2 | 2 | ||
| 3 | /* See doc/CUBE_INTERNAL.md for a description of the cube format */ | 3 | /* See doc/CUBE_INTERNAL.md for a description of the cube format */ |
| 4 | typedef struct { | ||
| 5 | uint8_t c[16]; | ||
| 6 | uint8_t e[16]; | ||
| 7 | } cube_arr_t; | ||
| 4 | #ifdef CUBE_AVX2 | 8 | #ifdef CUBE_AVX2 |
| 5 | typedef __m256i cube_t; | 9 | typedef __m256i cube_t; |
| 6 | #else | 10 | #else |
| 7 | typedef struct { uint8_t c[8]; uint8_t e[12]; } cube_t; | 11 | typedef cube_arr_t cube_t; |
| 8 | #endif | 12 | #endif |
| 9 | 13 | ||
| 10 | typedef uint8_t move_t; | 14 | typedef uint8_t move_t; |
| 11 | typedef uint8_t trans_t; | 15 | typedef uint8_t trans_t; |
| 12 | 16 | ||
| 13 | extern move_t inverse_move[]; | ||
| 14 | extern trans_t inverse_trans[]; | ||
| 15 | extern cube_t solvedcube; | ||
| 16 | |||
| 17 | /* Functions *****************************************************************/ | 17 | /* Functions *****************************************************************/ |
| 18 | 18 | ||
| 19 | int readmoves(char *, move_t *); | ||
| 20 | void writemoves(move_t *, int, char *); | ||
| 21 | trans_t readtrans(char *); | ||
| 22 | void writetrans(trans_t, char *); | ||
| 23 | |||
| 24 | move_t inverse_move(move_t); | ||
| 25 | trans_t inverse_trans(trans_t); | ||
| 26 | |||
| 19 | /* Not all formats are supported for both read and write. */ | 27 | /* Not all formats are supported for both read and write. */ |
| 20 | /* See doc/CUBE_TEXT.md for details. */ | 28 | /* See doc/CUBE_TEXT.md for details. */ |
| 21 | typedef enum {H48, SRC} format_t; | 29 | typedef enum {H48, SRC} format_t; |
| 22 | cube_t readcube(format_t, char *); | 30 | cube_t readcube(format_t, char *); |
| 23 | void writecube(format_t, cube_t, char *); | 31 | void writecube(format_t, cube_t, char *); |
| 24 | 32 | ||
| 33 | cube_t solvedcube(void); | ||
| 34 | cube_t zerocube(void); | ||
| 25 | bool issolvable(cube_t); | 35 | bool issolvable(cube_t); |
| 26 | bool equal(cube_t, cube_t); | 36 | bool equal(cube_t, cube_t); |
| 27 | bool issolved(cube_t); | 37 | bool issolved(cube_t); |
| 28 | bool iserror(cube_t); | 38 | bool iserror(cube_t); |
| 29 | 39 | ||
| 30 | int readmoves(char *, move_t *); | ||
| 31 | void writemoves(move_t *, int, char *); | ||
| 32 | |||
| 33 | trans_t readtrans(char *); | ||
| 34 | void writetrans(trans_t, char *); | ||
| 35 | |||
| 36 | cube_t move(cube_t, move_t); | 40 | cube_t move(cube_t, move_t); |
| 37 | cube_t inverse(cube_t); | 41 | cube_t inverse(cube_t); |
| 38 | cube_t compose(cube_t, cube_t); | 42 | cube_t compose(cube_t, cube_t); |
| 39 | |||
| 40 | /* See doc/TRANSFORMATIONS.md for how transformations are applied */ | ||
| 41 | cube_t transform(cube_t, trans_t); | 43 | cube_t transform(cube_t, trans_t); |
| 42 | 44 | ||
| 43 | /* Constants for moves and transformations ***********************************/ | 45 | /* Constants for moves and transformations ***********************************/ |
