summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/loopy.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/loopy.c')
-rw-r--r--apps/plugins/puzzles/src/loopy.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/loopy.c b/apps/plugins/puzzles/src/loopy.c
index 652b9ecc09..7d3436aacb 100644
--- a/apps/plugins/puzzles/src/loopy.c
+++ b/apps/plugins/puzzles/src/loopy.c
@@ -3054,6 +3054,24 @@ static char *interpret_move(const game_state *state, game_ui *ui,
3054 state->lines[e_next - g->edges] != state->lines[i]) 3054 state->lines[e_next - g->edges] != state->lines[i])
3055 break; 3055 break;
3056 3056
3057 if (e_next == e) {
3058 /*
3059 * Special case: we might have come all the
3060 * way round a loop and found our way back to
3061 * the same edge we started from. In that
3062 * situation, we must terminate not only this
3063 * while loop, but the 'for' outside it that
3064 * was tracing in both directions from the
3065 * starting edge, because if we let it trace
3066 * in the second direction then we'll only
3067 * find ourself traversing the same loop in
3068 * the other order and generate an encoded
3069 * move string that mentions the same set of
3070 * edges twice.
3071 */
3072 goto autofollow_done;
3073 }
3074
3057 dot = (e_next->dot1 != dot ? e_next->dot1 : e_next->dot2); 3075 dot = (e_next->dot1 != dot ? e_next->dot1 : e_next->dot2);
3058 if (movelen > movesize - 40) { 3076 if (movelen > movesize - 40) {
3059 movesize = movesize * 5 / 4 + 128; 3077 movesize = movesize * 5 / 4 + 128;
@@ -3064,6 +3082,7 @@ static char *interpret_move(const game_state *state, game_ui *ui,
3064 (int)(e_this - g->edges), button_char); 3082 (int)(e_this - g->edges), button_char);
3065 } 3083 }
3066 } 3084 }
3085 autofollow_done:;
3067 } 3086 }
3068 } 3087 }
3069 3088