diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-29 16:57:21 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-07-30 16:10:29 +0200 |
| commit | 6cf7cd87a90a1314332aace1d25b9c0f230dc227 (patch) | |
| tree | c246fbd0d400b34e6461e88a1bb50b4812eae8e5 /src/solvers/coord/solve.h | |
| parent | ea0387796a349c91032fbcb10f50c6ad8607b0f6 (diff) | |
| download | nissy-core-6cf7cd87a90a1314332aace1d25b9c0f230dc227.tar.gz nissy-core-6cf7cd87a90a1314332aace1d25b9c0f230dc227.zip | |
added drslice coordinate
Diffstat (limited to 'src/solvers/coord/solve.h')
| -rw-r--r-- | src/solvers/coord/solve.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h index 75ec200..280ca36 100644 --- a/src/solvers/coord/solve.h +++ b/src/solvers/coord/solve.h | |||
| @@ -76,6 +76,7 @@ coord_continue_onnormal(const dfsarg_solve_coord_t arg[static 1]) | |||
| 76 | if (nn + ni == 0) | 76 | if (nn + ni == 0) |
| 77 | return f & (NISSY_NISSFLAG_NORMAL | NISSY_NISSFLAG_MIXED); | 77 | return f & (NISSY_NISSFLAG_NORMAL | NISSY_NISSFLAG_MIXED); |
| 78 | 78 | ||
| 79 | /* TODO logic here can probably be simplified */ | ||
| 79 | if (arg->lastisnormal) | 80 | if (arg->lastisnormal) |
| 80 | return (f & NISSY_NISSFLAG_NORMAL) || | 81 | return (f & NISSY_NISSFLAG_NORMAL) || |
| 81 | ((f & NISSY_NISSFLAG_MIXED) && (ni > 0 || nn <= th)); | 82 | ((f & NISSY_NISSFLAG_MIXED) && (ni > 0 || nn <= th)); |
| @@ -98,6 +99,7 @@ coord_continue_oninverse(const dfsarg_solve_coord_t arg[static 1]) | |||
| 98 | if (nn + ni == 0) | 99 | if (nn + ni == 0) |
| 99 | return f & (NISSY_NISSFLAG_INVERSE | NISSY_NISSFLAG_MIXED); | 100 | return f & (NISSY_NISSFLAG_INVERSE | NISSY_NISSFLAG_MIXED); |
| 100 | 101 | ||
| 102 | /* TODO logic here can probably be simplified */ | ||
| 101 | if (!arg->lastisnormal) | 103 | if (!arg->lastisnormal) |
| 102 | return (f & NISSY_NISSFLAG_INVERSE) || | 104 | return (f & NISSY_NISSFLAG_INVERSE) || |
| 103 | ((f & NISSY_NISSFLAG_MIXED) && (nn > 0 || ni < th)); | 105 | ((f & NISSY_NISSFLAG_MIXED) && (nn > 0 || ni < th)); |
| @@ -118,7 +120,7 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[static 1]) | |||
| 118 | cube_t backup_cube, backup_inverse; | 120 | cube_t backup_cube, backup_inverse; |
| 119 | 121 | ||
| 120 | coord = arg->coord->coord(arg->cube, arg->coord_data); | 122 | coord = arg->coord->coord(arg->cube, arg->coord_data); |
| 121 | if (coord == 0) { | 123 | if (coord_is_solved(arg->coord, coord, arg->coord_data)) { |
| 122 | if (!coord_solution_admissible(arg)) | 124 | if (!coord_solution_admissible(arg)) |
| 123 | return 0; | 125 | return 0; |
| 124 | return appendsolution(arg->solution_moves, | 126 | return appendsolution(arg->solution_moves, |
| @@ -137,7 +139,7 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[static 1]) | |||
| 137 | ret = 0; | 139 | ret = 0; |
| 138 | if (coord_continue_onnormal(arg)) { | 140 | if (coord_continue_onnormal(arg)) { |
| 139 | l = arg->solution_moves->nmoves; | 141 | l = arg->solution_moves->nmoves; |
| 140 | mm = arg->coord->moves_mask; | 142 | mm = arg->coord->moves_mask_solve; |
| 141 | if (l != 0) { | 143 | if (l != 0) { |
| 142 | m = arg->solution_moves->moves[l-1]; | 144 | m = arg->solution_moves->moves[l-1]; |
| 143 | mm &= allowedmask[movebase(m)]; | 145 | mm &= allowedmask[movebase(m)]; |
| @@ -166,7 +168,7 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[static 1]) | |||
| 166 | 168 | ||
| 167 | if (coord_continue_oninverse(arg)) { | 169 | if (coord_continue_oninverse(arg)) { |
| 168 | l = arg->solution_moves->npremoves; | 170 | l = arg->solution_moves->npremoves; |
| 169 | mm = arg->coord->moves_mask; | 171 | mm = arg->coord->moves_mask_solve; |
| 170 | if (l != 0) { | 172 | if (l != 0) { |
| 171 | m = arg->solution_moves->premoves[l-1]; | 173 | m = arg->solution_moves->premoves[l-1]; |
| 172 | mm &= allowedmask[movebase(m)]; | 174 | mm &= allowedmask[movebase(m)]; |
| @@ -260,6 +262,7 @@ solve_coord( | |||
| 260 | int8_t d; | 262 | int8_t d; |
| 261 | uint8_t t; | 263 | uint8_t t; |
| 262 | int64_t ndepth; | 264 | int64_t ndepth; |
| 265 | uint64_t i; | ||
| 263 | cube_t c; | 266 | cube_t c; |
| 264 | const unsigned char *coord_data; | 267 | const unsigned char *coord_data; |
| 265 | const unsigned char *ptable; | 268 | const unsigned char *ptable; |
| @@ -314,7 +317,8 @@ solve_coord( | |||
| 314 | .nissflag = nissflag, | 317 | .nissflag = nissflag, |
| 315 | }; | 318 | }; |
| 316 | 319 | ||
| 317 | if (coord->coord(c, coord_data) == 0) { | 320 | i = coord->coord(c, coord_data); |
| 321 | if (coord_is_solved(coord, i, coord_data)) { | ||
| 318 | if (minmoves == 0 && !appendsolution(&solution_moves, | 322 | if (minmoves == 0 && !appendsolution(&solution_moves, |
| 319 | &solution_settings, &solution_list)) | 323 | &solution_settings, &solution_list)) |
| 320 | goto solve_coord_error_buffer; | 324 | goto solve_coord_error_buffer; |
