diff options
Diffstat (limited to 'cube.h')
| -rw-r--r-- | cube.h | 40 |
1 files changed, 9 insertions, 31 deletions
| @@ -16,13 +16,6 @@ corners is with respect to U/D. | |||
| 16 | 16 | ||
| 17 | The permutation of the center pieces is not stored. This means that the | 17 | The permutation of the center pieces is not stored. This means that the |
| 18 | cube is assumed to be in a fixed orientation. | 18 | cube is assumed to be in a fixed orientation. |
| 19 | |||
| 20 | TODO: define EO and CO better, explain how to use them | ||
| 21 | TODO: encode centers? | ||
| 22 | |||
| 23 | The exact cube type structure depends on your system's configuration. If | ||
| 24 | you operate on the cube only via the functions provided below, you don't | ||
| 25 | need to worry about this. | ||
| 26 | ******************************************************************************/ | 19 | ******************************************************************************/ |
| 27 | 20 | ||
| 28 | typedef struct { | 21 | typedef struct { |
| @@ -30,30 +23,15 @@ typedef struct { | |||
| 30 | uint8_t edge[12]; | 23 | uint8_t edge[12]; |
| 31 | } cube_t; | 24 | } cube_t; |
| 32 | 25 | ||
| 33 | /* Returns a copy of the solved cube */ | 26 | cube_t cube_new(void); |
| 34 | cube_t solvedcube(void); | 27 | cube_t cube_clone(cube_t); |
| 35 | 28 | bool cube_consistent(cube_t); | |
| 36 | /* Basic checks on the cube */ | 29 | bool cube_solvable(cube_t); |
| 37 | bool isconsistent(cube_t); | 30 | bool cube_solved(cube_t); |
| 38 | bool issolvable(cube_t); | 31 | bool cube_equal(cube_t, cube_t); |
| 39 | bool issolved(cube_t); | 32 | bool cube_error(cube_t); |
| 40 | bool equal(cube_t, cube_t); | 33 | cube_t cube_compose(cube_t, cube_t); |
| 41 | 34 | cube_t cube_inverse(cube_t); | |
| 42 | /* All functions can return an error value, use iserror() to check this */ | ||
| 43 | bool iserror(cube_t); | ||
| 44 | |||
| 45 | /* Apply the second cube on the first as a move sequence */ | ||
| 46 | cube_t compose(cube_t, cube_t); | ||
| 47 | |||
| 48 | /* Invert the cube */ | ||
| 49 | cube_t inverse(cube_t); | ||
| 50 | |||
| 51 | /* Check if a cube represent a valid state (possibly unsolvable) */ | ||
| 52 | |||
| 53 | /* TODO comment on these and the format for moves and trans */ | ||
| 54 | /* For trans, only one trans is supported */ | ||
| 55 | cube_t applymoves(cube_t, char *); | ||
| 56 | cube_t applytrans(cube_t, char *); | ||
| 57 | 35 | ||
| 58 | /****************************************************************************** | 36 | /****************************************************************************** |
| 59 | Read / write utilities | 37 | Read / write utilities |
