diff options
Diffstat (limited to '')
| -rwxr-xr-x | nissy | bin | 302912 -> 302560 bytes | |||
| -rw-r--r-- | src/solver.c | 55 |
2 files changed, 25 insertions, 30 deletions
| Binary files differ | |||
diff --git a/src/solver.c b/src/solver.c index 497ef04..82abd85 100644 --- a/src/solver.c +++ b/src/solver.c | |||
| @@ -36,6 +36,7 @@ void niss_eo_dfs(int eo, int scramble[], int eo_list[][30], int *eo_count, | |||
| 36 | int last1, int last2, int moves, int m, int d, int niss, | 36 | int last1, int last2, int moves, int m, int d, int niss, |
| 37 | int can_use_niss, int hide) { | 37 | int can_use_niss, int hide) { |
| 38 | 38 | ||
| 39 | |||
| 39 | if (*eo_count >= m || moves > d || | 40 | if (*eo_count >= m || moves > d || |
| 40 | ((!can_use_niss || niss) && moves + p_table[eo] > d)) | 41 | ((!can_use_niss || niss) && moves + p_table[eo] > d)) |
| 41 | return; | 42 | return; |
| @@ -55,17 +56,15 @@ void niss_eo_dfs(int eo, int scramble[], int eo_list[][30], int *eo_count, | |||
| 55 | return; | 56 | return; |
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | if (moves + p_table[eo] <= d) { | 59 | for (int i = 1; i < 19; i++) { |
| 59 | for (int i = 1; i < 19; i++) { | 60 | if (possible_next[last1][last2] & (1 << i)) { |
| 60 | if (possible_next[last1][last2] & (1 << i)) { | 61 | eo_list[*eo_count][moves] = niss ? -i : i; |
| 61 | eo_list[*eo_count][moves] = niss ? -i : i; | 62 | niss_eo_dfs(t_table[eo][i], scramble, eo_list, eo_count, t_table, |
| 62 | niss_eo_dfs(t_table[eo][i], scramble, eo_list, eo_count, t_table, | 63 | p_table, i, last1, moves+1, m, d, niss, |
| 63 | p_table, i, last1, moves+1, m, d, niss, | 64 | can_use_niss, hide); |
| 64 | can_use_niss, hide); | ||
| 65 | } | ||
| 66 | } | 65 | } |
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | if (*eo_count >= m) | 68 | if (*eo_count >= m) |
| 70 | return; | 69 | return; |
| 71 | eo_list[*eo_count][moves] = 0; | 70 | eo_list[*eo_count][moves] = 0; |
| @@ -141,16 +140,14 @@ void niss_dr_from_eo_dfs(int co, int epos, int scramble[], int eo_moves[30], | |||
| 141 | return; | 140 | return; |
| 142 | } | 141 | } |
| 143 | 142 | ||
| 144 | if (moves + p_table[co][epos] <= d) { | 143 | for (int i = 1; i < 19; i++) { |
| 145 | for (int i = 1; i < 19; i++) { | 144 | if (possible_next[last1][last2] & (1 << i) & mask) { |
| 146 | if (possible_next[last1][last2] & (1 << i) & mask) { | 145 | dr_list[*dr_count][moves] = niss ? -i : i; |
| 147 | dr_list[*dr_count][moves] = niss ? -i : i; | 146 | niss_dr_from_eo_dfs(co_t_table[co][i], epos_t_table[epos][i], |
| 148 | niss_dr_from_eo_dfs(co_t_table[co][i], epos_t_table[epos][i], | 147 | scramble, eo_moves, dr_list, dr_count, |
| 149 | scramble, eo_moves, dr_list, dr_count, | 148 | co_t_table, epos_t_table, p_table, mask, |
| 150 | co_t_table, epos_t_table, p_table, mask, | 149 | i, last1, last1_inv, last2_inv, |
| 151 | i, last1, last1_inv, last2_inv, | 150 | moves+1, m, d, niss, can_use_niss, hide); |
| 152 | moves+1, m, d, niss, can_use_niss, hide); | ||
| 153 | } | ||
| 154 | } | 151 | } |
| 155 | } | 152 | } |
| 156 | 153 | ||
| @@ -286,17 +283,15 @@ void niss_htr_from_dr_dfs(int cp, int eo3, int scramble[], int eodr_moves[30], | |||
| 286 | return; | 283 | return; |
| 287 | } | 284 | } |
| 288 | 285 | ||
| 289 | if (moves + cp_htr_pruning_table[cp] <= d) { | 286 | for (int i = 1; i < 19; i++) { |
| 290 | for (int i = 1; i < 19; i++) { | 287 | if (possible_next[last1][last2] & (1 << i) & mask) { |
| 291 | if (possible_next[last1][last2] & (1 << i) & mask) { | 288 | htr_list[*htr_count][moves] = niss ? -i : i; |
| 292 | htr_list[*htr_count][moves] = niss ? -i : i; | 289 | niss_htr_from_dr_dfs(cp_transition_table[cp][i], eo3_t_table[eo3][i], |
| 293 | niss_htr_from_dr_dfs(cp_transition_table[cp][i], eo3_t_table[eo3][i], | 290 | scramble, eodr_moves, htr_list, htr_count, |
| 294 | scramble, eodr_moves, htr_list, htr_count, | 291 | eo3_t_table, cp_to_htr_pruning_table, |
| 295 | eo3_t_table, cp_to_htr_pruning_table, | 292 | cp_htr_pruning_table, cp_finish_pruning_table, |
| 296 | cp_htr_pruning_table, cp_finish_pruning_table, | 293 | mask, i, last1, last1_inv, last2_inv, |
| 297 | mask, i, last1, last1_inv, last2_inv, | 294 | moves+1, m, d, niss, can_use_niss, hide); |
| 298 | moves+1, m, d, niss, can_use_niss, hide); | ||
| 299 | } | ||
| 300 | } | 295 | } |
| 301 | } | 296 | } |
| 302 | 297 | ||
