aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/coord/solve.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-04-01 09:33:26 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-04-01 09:33:26 +0200
commitb0053277e385bee23336d1fe6b69a12f49f9172f (patch)
tree531e44cd6f8e807c991d0a46692140667939fbe3 /src/solvers/coord/solve.h
parentb6c1ff6cfdfe0f4ce602fe83e54c3112a1c95690 (diff)
downloadnissy-core-b0053277e385bee23336d1fe6b69a12f49f9172f.tar.gz
nissy-core-b0053277e385bee23336d1fe6b69a12f49f9172f.zip
simplified allowedmoves logic
Diffstat (limited to 'src/solvers/coord/solve.h')
-rw-r--r--src/solvers/coord/solve.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h
index c3fbd02..fa4134a 100644
--- a/src/solvers/coord/solve.h
+++ b/src/solvers/coord/solve.h
@@ -135,7 +135,12 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[static 1])
135 ret = 0; 135 ret = 0;
136 if (coord_continue_onnormal(arg)) { 136 if (coord_continue_onnormal(arg)) {
137 l = arg->solution_moves->nmoves; 137 l = arg->solution_moves->nmoves;
138 mm = allowednextmove_mask(l, arg->solution_moves->moves); 138 if (l == 0) {
139 mm = MM_ALLMOVES;
140 } else {
141 m = arg->solution_moves->moves[l-1];
142 mm = allowedmask[movebase(m)];
143 }
139 arg->solution_moves->nmoves++; 144 arg->solution_moves->nmoves++;
140 arg->lastisnormal = true; 145 arg->lastisnormal = true;
141 146
@@ -160,7 +165,12 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[static 1])
160 165
161 if (coord_continue_oninverse(arg)) { 166 if (coord_continue_oninverse(arg)) {
162 l = arg->solution_moves->npremoves; 167 l = arg->solution_moves->npremoves;
163 mm = allowednextmove_mask(l, arg->solution_moves->premoves); 168 if (l == 0) {
169 mm = MM_ALLMOVES;
170 } else {
171 m = arg->solution_moves->premoves[l-1];
172 mm = allowedmask[movebase(m)];
173 }
164 arg->solution_moves->npremoves++; 174 arg->solution_moves->npremoves++;
165 arg->lastisnormal = false; 175 arg->lastisnormal = false;
166 176

Generated with cgit - Back to sebastiano.tronto.net