diff options
Diffstat (limited to 'src/nissy.h')
| -rw-r--r-- | src/nissy.h | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/src/nissy.h b/src/nissy.h index 7a39927..8394fad 100644 --- a/src/nissy.h +++ b/src/nissy.h | |||
| @@ -24,6 +24,7 @@ for example 'rotation UF' or 'mirrored BL'. | |||
| 24 | #define NISSY_SIZE_B32 22U | 24 | #define NISSY_SIZE_B32 22U |
| 25 | #define NISSY_SIZE_H48 88U | 25 | #define NISSY_SIZE_H48 88U |
| 26 | #define NISSY_SIZE_TRANSFORMATION 12U | 26 | #define NISSY_SIZE_TRANSFORMATION 12U |
| 27 | #define NISSY_SIZE_SOLVE_STATS 10U | ||
| 27 | 28 | ||
| 28 | /* Flags for NISS options */ | 29 | /* Flags for NISS options */ |
| 29 | #define NISSY_NISSFLAG_NORMAL 1U | 30 | #define NISSY_NISSFLAG_NORMAL 1U |
| @@ -58,7 +59,8 @@ Return values: | |||
| 58 | NISSY_ERROR_INVALID_CUBE - At least one of the given cubes is invalid. | 59 | NISSY_ERROR_INVALID_CUBE - At least one of the given cubes is invalid. |
| 59 | NISSY_ERROR_UNKNOWN - An unknown error occurred. | 60 | NISSY_ERROR_UNKNOWN - An unknown error occurred. |
| 60 | */ | 61 | */ |
| 61 | long long nissy_compose( | 62 | long long |
| 63 | nissy_compose( | ||
| 62 | const char cube[static NISSY_SIZE_B32], | 64 | const char cube[static NISSY_SIZE_B32], |
| 63 | const char permutation[static NISSY_SIZE_B32], | 65 | const char permutation[static NISSY_SIZE_B32], |
| 64 | char result[static NISSY_SIZE_B32] | 66 | char result[static NISSY_SIZE_B32] |
| @@ -79,7 +81,8 @@ Return values: | |||
| 79 | NISSY_ERROR_INVALID_CUBE - The given cube is invalid. | 81 | NISSY_ERROR_INVALID_CUBE - The given cube is invalid. |
| 80 | NISSY_ERROR_UNKNOWN - An unknown error occurred. | 82 | NISSY_ERROR_UNKNOWN - An unknown error occurred. |
| 81 | */ | 83 | */ |
| 82 | long long nissy_inverse( | 84 | long long |
| 85 | nissy_inverse( | ||
| 83 | const char cube[static NISSY_SIZE_B32], | 86 | const char cube[static NISSY_SIZE_B32], |
| 84 | char result[static NISSY_SIZE_B32] | 87 | char result[static NISSY_SIZE_B32] |
| 85 | ); | 88 | ); |
| @@ -101,7 +104,8 @@ Return values: | |||
| 101 | NISSY_ERROR_INVALID_MOVES - The given moves are invalid. | 104 | NISSY_ERROR_INVALID_MOVES - The given moves are invalid. |
| 102 | NISSY_ERROR_NULL_POINTER - The 'moves' argument is NULL. | 105 | NISSY_ERROR_NULL_POINTER - The 'moves' argument is NULL. |
| 103 | */ | 106 | */ |
| 104 | long long nissy_applymoves( | 107 | long long |
| 108 | nissy_applymoves( | ||
| 105 | const char cube[static NISSY_SIZE_B32], | 109 | const char cube[static NISSY_SIZE_B32], |
| 106 | const char *moves, | 110 | const char *moves, |
| 107 | char result[static NISSY_SIZE_B32] | 111 | char result[static NISSY_SIZE_B32] |
| @@ -122,7 +126,8 @@ Return values: | |||
| 122 | NISSY_ERROR_INVALID_CUBE - The given cube is invalid. | 126 | NISSY_ERROR_INVALID_CUBE - The given cube is invalid. |
| 123 | NISSY_ERROR_INVALID_TRANS - The given transformation is invalid. | 127 | NISSY_ERROR_INVALID_TRANS - The given transformation is invalid. |
| 124 | */ | 128 | */ |
| 125 | long long nissy_applytrans( | 129 | long long |
| 130 | nissy_applytrans( | ||
| 126 | const char cube[static NISSY_SIZE_B32], | 131 | const char cube[static NISSY_SIZE_B32], |
| 127 | const char transformation[static NISSY_SIZE_TRANSFORMATION], | 132 | const char transformation[static NISSY_SIZE_TRANSFORMATION], |
| 128 | char result[static NISSY_SIZE_B32] | 133 | char result[static NISSY_SIZE_B32] |
| @@ -147,7 +152,8 @@ Return values: | |||
| 147 | NISSY_ERROR_NULL_POINTER - At least one of 'format_in', 'format_out' or | 152 | NISSY_ERROR_NULL_POINTER - At least one of 'format_in', 'format_out' or |
| 148 | 'cube_string' arguments is NULL. | 153 | 'cube_string' arguments is NULL. |
| 149 | */ | 154 | */ |
| 150 | long long nissy_convert( | 155 | long long |
| 156 | nissy_convert( | ||
| 151 | const char *format_in, | 157 | const char *format_in, |
| 152 | const char *format_out, | 158 | const char *format_out, |
| 153 | const char *cube_string, | 159 | const char *cube_string, |
| @@ -174,7 +180,8 @@ Return values: | |||
| 174 | NISSY_WARNING_UNSOLVABLE - The resulting cube is unsolvable. | 180 | NISSY_WARNING_UNSOLVABLE - The resulting cube is unsolvable. |
| 175 | NISSY_ERROR_OPTIONS - One or more of the given parameters is invalid. | 181 | NISSY_ERROR_OPTIONS - One or more of the given parameters is invalid. |
| 176 | */ | 182 | */ |
| 177 | long long nissy_getcube( | 183 | long long |
| 184 | nissy_getcube( | ||
| 178 | long long ep, | 185 | long long ep, |
| 179 | long long eo, | 186 | long long eo, |
| 180 | long long cp, | 187 | long long cp, |
| @@ -196,7 +203,8 @@ Return values: | |||
| 196 | NISSY_ERROR_UNKNOWN - An unknown error occurred. | 203 | NISSY_ERROR_UNKNOWN - An unknown error occurred. |
| 197 | Any value >= 0 - The size of the data, in bytes. | 204 | Any value >= 0 - The size of the data, in bytes. |
| 198 | */ | 205 | */ |
| 199 | long long nissy_datasize( | 206 | long long |
| 207 | nissy_datasize( | ||
| 200 | const char *solver | 208 | const char *solver |
| 201 | ); | 209 | ); |
| 202 | 210 | ||
| @@ -215,7 +223,8 @@ Return values: | |||
| 215 | NISSY_ERROR_UNKNOWN - An error occurred while generating the data. | 223 | NISSY_ERROR_UNKNOWN - An error occurred while generating the data. |
| 216 | Any value >= 0 - The size of the data, in bytes. | 224 | Any value >= 0 - The size of the data, in bytes. |
| 217 | */ | 225 | */ |
| 218 | long long nissy_gendata( | 226 | long long |
| 227 | nissy_gendata( | ||
| 219 | const char *solver, | 228 | const char *solver, |
| 220 | unsigned long long data_size, | 229 | unsigned long long data_size, |
| 221 | char data[data_size] | 230 | char data[data_size] |
| @@ -232,7 +241,8 @@ Return values: | |||
| 232 | NISSY_OK - The data is valid. | 241 | NISSY_OK - The data is valid. |
| 233 | NISSY_ERROR_DATA - The data is invalid. | 242 | NISSY_ERROR_DATA - The data is invalid. |
| 234 | */ | 243 | */ |
| 235 | long long nissy_checkdata( | 244 | long long |
| 245 | nissy_checkdata( | ||
| 236 | unsigned long long data_size, | 246 | unsigned long long data_size, |
| 237 | const char data[data_size] | 247 | const char data[data_size] |
| 238 | ); | 248 | ); |
| @@ -255,6 +265,7 @@ Parameters: | |||
| 255 | sols - The return parameter for the solutions. The solutions are | 265 | sols - The return parameter for the solutions. The solutions are |
| 256 | separated by a '\n' (newline) and a '\0' (NULL character) | 266 | separated by a '\n' (newline) and a '\0' (NULL character) |
| 257 | terminates the list. | 267 | terminates the list. |
| 268 | stats - An array to store some statistics about the solve. | ||
| 258 | 269 | ||
| 259 | Return values: | 270 | Return values: |
| 260 | NISSY_OK - Cube solved succesfully. | 271 | NISSY_OK - Cube solved succesfully. |
| @@ -266,7 +277,8 @@ Return values: | |||
| 266 | NISSY_ERROR_NULL_POINTER - The 'solver' argument is null. | 277 | NISSY_ERROR_NULL_POINTER - The 'solver' argument is null. |
| 267 | Any value >= 0 - The number of solutions found. | 278 | Any value >= 0 - The number of solutions found. |
| 268 | */ | 279 | */ |
| 269 | long long nissy_solve( | 280 | long long |
| 281 | nissy_solve( | ||
| 270 | const char cube[static NISSY_SIZE_B32], | 282 | const char cube[static NISSY_SIZE_B32], |
| 271 | const char *solver, | 283 | const char *solver, |
| 272 | unsigned nissflag, | 284 | unsigned nissflag, |
| @@ -277,7 +289,8 @@ long long nissy_solve( | |||
| 277 | unsigned long long data_size, | 289 | unsigned long long data_size, |
| 278 | const char data[data_size], | 290 | const char data[data_size], |
| 279 | unsigned sols_size, | 291 | unsigned sols_size, |
| 280 | char sols[sols_size] | 292 | char sols[sols_size], |
| 293 | long long stats[static NISSY_SIZE_SOLVE_STATS] | ||
| 281 | ); | 294 | ); |
| 282 | 295 | ||
| 283 | /* | 296 | /* |
| @@ -289,7 +302,8 @@ Return values: | |||
| 289 | NISSY_ERROR_NULL_POINTER - The 'moves' argument is NULL. | 302 | NISSY_ERROR_NULL_POINTER - The 'moves' argument is NULL. |
| 290 | Any value >= 0 - The number of moves. | 303 | Any value >= 0 - The number of moves. |
| 291 | */ | 304 | */ |
| 292 | long long nissy_countmoves( | 305 | long long |
| 306 | nissy_countmoves( | ||
| 293 | const char *moves | 307 | const char *moves |
| 294 | ); | 308 | ); |
| 295 | 309 | ||
| @@ -303,7 +317,8 @@ Return values: | |||
| 303 | NISSY_OK - Logger set succesfully. No warning or error is goind to be given | 317 | NISSY_OK - Logger set succesfully. No warning or error is goind to be given |
| 304 | if the logger is NULL or invalid. | 318 | if the logger is NULL or invalid. |
| 305 | */ | 319 | */ |
| 306 | long long nissy_setlogger( | 320 | long long |
| 321 | nissy_setlogger( | ||
| 307 | void (*logger_function)(const char *, ...) | 322 | void (*logger_function)(const char *, ...) |
| 308 | ); | 323 | ); |
| 309 | 324 | ||
