diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2023-03-05 10:13:01 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2023-03-05 10:13:01 +0100 |
| commit | 87a15e960e31365698df7e06cd3e6b851e17c1a5 (patch) | |
| tree | 606a42e6251df3c24d92a2edefce723bdd103620 /src/steps.c | |
| parent | 3bfd0bb403d62bd942d1912d085ea59b156062fd (diff) | |
| download | nissy-87a15e960e31365698df7e06cd3e6b851e17c1a5.tar.gz nissy-87a15e960e31365698df7e06cd3e6b851e17c1a5.zip | |
I made a mess, but it works. Still need to implement new optimal solver.
After that, a big redesign is due.
Diffstat (limited to 'src/steps.c')
| -rw-r--r-- | src/steps.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/steps.c b/src/steps.c index 2f5fd2c..cdba763 100644 --- a/src/steps.c +++ b/src/steps.c | |||
| @@ -106,11 +106,12 @@ check_htr(Cube *cube) | |||
| 106 | return true; | 106 | return true; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | bool | 109 | Alg * |
| 110 | validate_singlecw_ending(Alg *alg) | 110 | validate_singlecw_ending(Alg *alg) |
| 111 | { | 111 | { |
| 112 | int i; | 112 | int i; |
| 113 | bool nor, inv; | 113 | bool nor, inv; |
| 114 | Alg *ret; | ||
| 114 | Move l2 = NULLMOVE, l1 = NULLMOVE, l2i = NULLMOVE, l1i = NULLMOVE; | 115 | Move l2 = NULLMOVE, l1 = NULLMOVE, l2i = NULLMOVE, l1i = NULLMOVE; |
| 115 | 116 | ||
| 116 | for (i = 0; i < alg->len; i++) { | 117 | for (i = 0; i < alg->len; i++) { |
| @@ -126,11 +127,19 @@ validate_singlecw_ending(Alg *alg) | |||
| 126 | nor = l1 ==base_move(l1) && (!commute(l1, l2) ||l2 ==base_move(l2)); | 127 | nor = l1 ==base_move(l1) && (!commute(l1, l2) ||l2 ==base_move(l2)); |
| 127 | inv = l1i==base_move(l1i) && (!commute(l1i,l2i)||l2i==base_move(l2i)); | 128 | inv = l1i==base_move(l1i) && (!commute(l1i,l2i)||l2i==base_move(l2i)); |
| 128 | 129 | ||
| 129 | return nor && inv; | 130 | if (nor && inv) { |
| 131 | ret = new_alg(""); | ||
| 132 | copy_alg(alg, ret); | ||
| 133 | } else { | ||
| 134 | ret = NULL; | ||
| 135 | } | ||
| 136 | |||
| 137 | return ret; | ||
| 130 | } | 138 | } |
| 131 | 139 | ||
| 132 | /* Public functions **********************************************************/ | 140 | /* Public functions **********************************************************/ |
| 133 | 141 | ||
| 142 | /* | ||
| 134 | void | 143 | void |
| 135 | compute_ind(Step *s, Cube *cube, Movable *ind) | 144 | compute_ind(Step *s, Cube *cube, Movable *ind) |
| 136 | { | 145 | { |
| @@ -147,6 +156,7 @@ compute_ind(Step *s, Cube *cube, Movable *ind) | |||
| 147 | ind[i].t = transform_trans(tt, t); | 156 | ind[i].t = transform_trans(tt, t); |
| 148 | } | 157 | } |
| 149 | } | 158 | } |
| 159 | */ | ||
| 150 | 160 | ||
| 151 | void | 161 | void |
| 152 | prepare_cs(ChoiceStep *cs, SolveOptions *opts) | 162 | prepare_cs(ChoiceStep *cs, SolveOptions *opts) |
