diff options
Diffstat (limited to '')
| -rw-r--r-- | cube.h | 79 |
1 files changed, 50 insertions, 29 deletions
| @@ -52,8 +52,8 @@ cube_t inverse(cube_t); | |||
| 52 | 52 | ||
| 53 | /* TODO comment on these and the format for moves and trans */ | 53 | /* TODO comment on these and the format for moves and trans */ |
| 54 | /* For trans, only one trans is supported */ | 54 | /* For trans, only one trans is supported */ |
| 55 | cube_t applymoves(cube_t, char *); | 55 | cube_t applymoves(cube_t, const char *); |
| 56 | cube_t applytrans(cube_t, char *); | 56 | cube_t applytrans(cube_t, const char *); |
| 57 | 57 | ||
| 58 | /****************************************************************************** | 58 | /****************************************************************************** |
| 59 | Read / write utilities | 59 | Read / write utilities |
| @@ -91,8 +91,8 @@ Multiple representations of the cube as text are supported: | |||
| 91 | in cube_t. Corners come first, followed by edge (unlike H48). | 91 | in cube_t. Corners come first, followed by edge (unlike H48). |
| 92 | ******************************************************************************/ | 92 | ******************************************************************************/ |
| 93 | 93 | ||
| 94 | cube_t readcube(char *format, char *buf); | 94 | cube_t readcube(const char *format, const char *buf); |
| 95 | void writecube(char *format, cube_t cube, char *buf); | 95 | void writecube(const char *format, cube_t cube, char *buf); |
| 96 | 96 | ||
| 97 | /****************************************************************************** | 97 | /****************************************************************************** |
| 98 | Solvers | 98 | Solvers |
| @@ -108,36 +108,57 @@ could. | |||
| 108 | ******************************************************************************/ | 108 | ******************************************************************************/ |
| 109 | 109 | ||
| 110 | int64_t solve( | 110 | int64_t solve( |
| 111 | cube_t cube, /* The cube to solve. Must be solvable. */ | 111 | /* The cube to solve. Must be solvable. */ |
| 112 | char *solver, /* Supported solvers: | 112 | cube_t cube, |
| 113 | * "optimal" - currently the same as "simple" | 113 | |
| 114 | * "simple" - a simple, slow solver using no tables | 114 | /* Supported solvers: |
| 115 | */ | 115 | * "optimal" - currently the same as "simple" |
| 116 | char *options, /* Some solvers accept extra options, | 116 | * "simple" - a simple, slow solver without tables |
| 117 | * like "!filter". | 117 | */ |
| 118 | */ | 118 | const char *solver, |
| 119 | char *nisstype, /* Can be "normal", "inverse", "mixed" or "linear". */ | 119 | |
| 120 | int8_t minmoves, /* The minimum number of moves. Must be >= 0. */ | 120 | /* Some solvers accept extra options,like "!filter". */ |
| 121 | int8_t maxmoves, /* The maximum number of moves. If negative, the | 121 | const char *options, |
| 122 | * maximum length is unlimited. | 122 | |
| 123 | */ | 123 | /* Can be "normal", "inverse", "mixed" or "linear". */ |
| 124 | int64_t maxsols, /* The maximum number of solutions. */ | 124 | const char *nisstype, |
| 125 | int8_t optimal, /* All solutions at most "optimal" moves from the | 125 | |
| 126 | * shortest solution (respecting minmoves) are found. | 126 | /* The minimum number of moves. Must be >= 0. */ |
| 127 | * If negative, this parameter is ignored. | 127 | int8_t minmoves, |
| 128 | */ | 128 | |
| 129 | void *data, /* Some solvers require extra data to function | 129 | /* The maximum number of moves. If negative, the maximum length |
| 130 | * properly (for example, pruning tables). This data | 130 | * is unlimited. |
| 131 | * can be generated with gendata(), see below. | 131 | */ |
| 132 | */ | 132 | int8_t maxmoves, |
| 133 | char *solutions /* The solutions (return parameter) */ | 133 | |
| 134 | /* The maximum number of solutions. */ | ||
| 135 | int64_t maxsols, | ||
| 136 | |||
| 137 | /* All solutions at most "optimal" moves from the shortest solution | ||
| 138 | * (respecting minmoves) are found. If negative, it is ignored. | ||
| 139 | */ | ||
| 140 | int8_t optimal, | ||
| 141 | |||
| 142 | /* Some solvers require extra data to function properly (for example, | ||
| 143 | * pruning tables). This data can be generated with gendata(). | ||
| 144 | */ | ||
| 145 | const void *data, | ||
| 146 | |||
| 147 | /* The solutions (return parameter) */ | ||
| 148 | char *solutions | ||
| 134 | ); | 149 | ); |
| 135 | 150 | ||
| 136 | /* Solving n cubes optimally, one solutions per cube. Options are similar | 151 | /* Solving n cubes optimally, one solutions per cube. Options are similar |
| 137 | * to solve(). | 152 | * to solve(). |
| 138 | */ | 153 | */ |
| 139 | void multisolve(int n, cube_t *cube, char *solver, void *data, char *sols); | 154 | void multisolve( |
| 155 | int n, | ||
| 156 | cube_t *cube, | ||
| 157 | const char *solver, | ||
| 158 | const void *data, | ||
| 159 | char *sols | ||
| 160 | ); | ||
| 140 | 161 | ||
| 141 | /* Returns the number of bytes written to data, -1 in case of error. | 162 | /* Returns the number of bytes written to data, -1 in case of error. |
| 142 | * TODO: write down how much memory every solver requires. */ | 163 | * TODO: write down how much memory every solver requires. */ |
| 143 | int64_t gendata(char *solver, void *data); | 164 | int64_t gendata(const char *solver, void *data); |
