summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/range.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/range.c')
-rw-r--r--apps/plugins/puzzles/src/range.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/plugins/puzzles/src/range.c b/apps/plugins/puzzles/src/range.c
index 41c6a35..03bdf6d 100644
--- a/apps/plugins/puzzles/src/range.c
+++ b/apps/plugins/puzzles/src/range.c
@@ -613,15 +613,16 @@ static move *solver_reasoning_recursion(game_state *state,
/* FIXME: add enum alias for smallest and largest (or N) */
for (colour = M_BLACK; colour <= M_WHITE; ++colour) {
newstate = dup_game(state);
- newstate->grid[cell] = colour;
+ newstate->grid[cell] = colour == M_BLACK ? BLACK : WHITE;
recursive_result = do_solve(newstate, nclues, clues, buf,
DIFF_RECURSION);
- free_game(newstate);
if (recursive_result == NULL) {
+ free_game(newstate);
solver_makemove(r, c, M_BLACK + M_WHITE - colour, state, &buf);
return buf;
}
for (i = 0; i < n && newstate->grid[i] != EMPTY; ++i);
+ free_game(newstate);
if (i == n) return buf;
}
}
@@ -1812,6 +1813,7 @@ struct game const thegame = {
free_ui,
encode_ui,
decode_ui,
+ NULL, /* game_request_keys */
game_changed_state,
interpret_move,
execute_move,