diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-08 18:53:00 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-11-08 18:53:00 +0100 |
| commit | 5bdf6e73179cf944ce82606545beb0b0d63a59a3 (patch) | |
| tree | edc0897f2479e1b069d9e36183b92c0416d243b6 /cube.h | |
| parent | e2004826a56b1e2cac8b3d5a94535e480ca2855d (diff) | |
| download | nissy-core-5bdf6e73179cf944ce82606545beb0b0d63a59a3.tar.gz nissy-core-5bdf6e73179cf944ce82606545beb0b0d63a59a3.zip | |
Improved comments
Diffstat (limited to '')
| -rw-r--r-- | cube.h | 41 |
1 files changed, 38 insertions, 3 deletions
| @@ -169,9 +169,44 @@ int16_t coord_eo(cube_t); /* Edge orientation */ | |||
| 169 | /****************************************************************************** | 169 | /****************************************************************************** |
| 170 | Solvers | 170 | Solvers |
| 171 | 171 | ||
| 172 | Solvers return -1 in case of error, the number of solutions otherwise | 172 | All solvers work at fixed depth, i.e. they will only find solutions of the |
| 173 | specified length. Iterating over the possible lengths, if desired, is left as | ||
| 174 | an implementation detail for the user of this library. | ||
| 173 | 175 | ||
| 174 | TODO | 176 | The solutions are returned as a list of moves, which can then be converted to |
| 177 | a string using writemoves(). | ||
| 178 | |||
| 179 | Unless specified otherwise, all the solutions are not trivially simplifiable. | ||
| 180 | This means that sequences like U U2 or R L R will not appear in any solution. | ||
| 181 | Moreover, two consecutive parallel moves are always going to be sorted in | ||
| 182 | increasing order. For example, L R2 may never appear in a solution, but R2 L | ||
| 183 | could. | ||
| 184 | |||
| 185 | Solvers return -1 in case of error, the number of solutions found otherwise. | ||
| 186 | |||
| 187 | TODO NISS / INVERSE / LINEAR as a mask? | ||
| 188 | |||
| 189 | All solvers take at least the following parameters, satisfying the conditions | ||
| 190 | in square brackets: | ||
| 191 | - cube_t cube [issolvable(cube)]: The cube to solve. | ||
| 192 | - uint8_t depth [depth <= 20]: The lenght of the solution. | ||
| 193 | - int maxsols: The maximum number of solutions to find. The solver | ||
| 194 | stops when the limit is reached. If set to a negative number, all | ||
| 195 | the solutions are found. | ||
| 196 | - move_t *ret: The array where the moves of the solutions are stored. | ||
| 197 | There is no separator between different solutions; to read the | ||
| 198 | solutions, use the fact that all solutions has the same length: the | ||
| 199 | i-th move of the j-th solution is ret[j*depth + i]. | ||
| 200 | |||
| 201 | Some solvers take other parameters. See below for details. | ||
| 175 | ******************************************************************************/ | 202 | ******************************************************************************/ |
| 176 | 203 | ||
| 177 | int solve_generic(cube_t, int (*)(cube_t), uint8_t, int, move_t *); | 204 | int solve_generic( |
| 205 | cube_t cube, | ||
| 206 | uint8_t depth, | ||
| 207 | int maxsols, | ||
| 208 | move_t *ret | ||
| 209 | int (*estimate)(cube_t), | ||
| 210 | ); | ||
| 211 | |||
| 212 | int solve_light(cube_t, int | ||
