From d9f40f59c9f14bef7f87c11da7494f7dcf1457b4 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 10 Jun 2024 22:22:03 +0200 Subject: Started cube.h refactor --- src/cube.h | 81 +++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 24 deletions(-) (limited to 'src/cube.h') diff --git a/src/cube.h b/src/cube.h index d30c1d4..b5f4211 100644 --- a/src/cube.h +++ b/src/cube.h @@ -1,32 +1,65 @@ -/* TODO: change cube to const char [static 22], or const char * */ -/* TODO: return error code */ -/* TODO: implement all of this, or move the implementation to cube_public.h */ -/* TODO: document in a separate file, possibly leave here 1-line comments */ - -cube_t compose(cube_t cube, cube_t perm); -cube_t inverse(cube_t cube); -cube_t solvedcube(void); -cube_t applymoves(cube_t, const char *); -cube_t applytrans(cube_t, const char *); -cube_t readcube(const char *format, const char *buf); -void writecube(const char *format, cube_t cube, char *buf); -int64_t solve( - cube_t cube, +/* +All the functions below return 0 in case of success and a positive number +in case of error. See (TODO: documentation) for details. +*/ + +int nissy_compose( + const char cube[static 22], + const char permutation[static 22], + char result[static 22] +); + +int nissy_inverse( + const char cube[static 22], + char result[static 22] +); + +int nissy_applyoves( + const char cube[static 22], + const char *moves, + char result[static 22] +); + +int nissy_applytrans( + const char cube[static 22], + const char *transformation, + char result[static 22] +); + +int nissy_frommoves( + const char *moves, + char result[static 22] +); + +int nissy_readcube( + const char *format, + const char *cube_string, + char result[static 22] +); + +int nissy_writecube( + const char *format, + const char cube[static 22], + char *result +); + +int nissy_gendata( + const char *solver, + const char *options, + void *generated_data, + int64_t *generated_bytes +); + +int nissy_solve( + const char cube[static 22], const char *solver, const char *options, const char *nisstype, int8_t minmoves, int8_t maxmoves, - int64_t maxsols, + int64_t maxsolutions, int8_t optimal, - const void *data, - char *solutions -); -void multisolve( - int n, - cube_t *cube, - const char *solver, const void *data, - char *sols + char *solutions, + int *n_solutions ); -int64_t gendata(const char *solver, const char *options, void *data); -- cgit v1.3