From 2a8d66906dde19ffb7315fb3f60a396a71612037 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 27 Oct 2023 16:25:15 +0200 Subject: Small cleanup --- src/cube.h | 81 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 40 deletions(-) (limited to 'src/cube.h') diff --git a/src/cube.h b/src/cube.h index cac6b01..1e11432 100644 --- a/src/cube.h +++ b/src/cube.h @@ -1,4 +1,44 @@ -/* Constants *****************************************************************/ +/* Types *********************************************************************/ + +/* TODO: ifdef for different implementations */ +/* See doc/CUBE_INTERNAL.md for a description of the cube format */ +typedef struct { + uint8_t c[8]; + uint8_t e[12]; +} cube_t; + +typedef uint8_t move_t; +typedef uint8_t trans_t; + +extern cube_t solvedcube; + +/* Functions *****************************************************************/ + +/* Not all formats are supported for both read and write. */ +/* See doc/CUBE_TEXT.md for details. */ +typedef enum {H48, SRC} format_t; +cube_t readcube(format_t, char *); +void writecube(format_t, cube_t, char *); + +bool issolvable(cube_t); +bool equal(cube_t, cube_t); +bool issolved(cube_t); +bool iserror(cube_t); + +int readmoves(char *, move_t *); +void writemoves(move_t *, int, char *); + +trans_t readtrans(char *); +void writetrans(trans_t, char *); + +cube_t move(cube_t, move_t); +cube_t inverse(cube_t); +cube_t compose(cube_t, cube_t); + +/* See doc/TRANSFORMATIONS.md for how transformations are applied */ +cube_t transform(cube_t, trans_t); + +/* Constants for moves and transformations ***********************************/ /* Standard moves */ #define U 0U @@ -76,42 +116,3 @@ #define errormove 99U #define errortrans 99U -/* Types *********************************************************************/ - -/* TODO: ifdef for different implementations */ -/* See doc/CUBE_INTERNAL.md for a description of the cube format */ -typedef struct { - uint8_t c[8]; - uint8_t e[12]; -} cube_t; - -typedef uint8_t move_t; -typedef uint8_t trans_t; - -extern cube_t solvedcube; - -/* Functions *****************************************************************/ - -/* Not all formats are supported for both read and write. */ -/* See doc/CUBE_TEXT.md for details. */ -typedef enum {H48, SRC} format_t; -cube_t readcube(format_t, char *); -void writecube(format_t, cube_t, char *); - -bool issolvable(cube_t); -bool equal(cube_t, cube_t); -bool issolved(cube_t); -bool iserror(cube_t); - -int readmoves(char *, move_t *); -void writemoves(move_t *, int, char *); - -trans_t readtrans(char *); -void writetrans(trans_t, char *); - -cube_t move(cube_t, move_t); -cube_t inverse(cube_t); -cube_t compose(cube_t, cube_t); - -/* See doc/TRANSFORMATIONS.md for how transformations are applied */ -cube_t transform(cube_t, trans_t); -- cgit v1.3