summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/range.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2018-04-17 18:18:40 -0400
committerFranklin Wei <git@fwei.tk>2018-04-17 18:20:12 -0400
commit6dc9d1d7309613fdc0518c03b2cdf3253d4c52fd (patch)
treef6c9abf4a05f640134aa3d248a9498a06f596712 /apps/plugins/puzzles/src/range.c
parent7a12e796a62b916dae5de1b2986e8cb11ac5be4c (diff)
downloadrockbox-6dc9d1d7309613fdc0518c03b2cdf3253d4c52fd.zip
rockbox-6dc9d1d7309613fdc0518c03b2cdf3253d4c52fd.tar.gz
rockbox-6dc9d1d7309613fdc0518c03b2cdf3253d4c52fd.tar.bz2
rockbox-6dc9d1d7309613fdc0518c03b2cdf3253d4c52fd.tar.xz
puzzles: enable all the remaining games
They all work now :). I merged in part of Chris Boyle's Android port of Puzzles to give the front end a way to know what keys the back end needs. This also re-syncs to the latest upstream sources. Change-Id: Ie0409bbb32f617ae5abf4f81be3b45d1552db9bb
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,