From 6dc9d1d7309613fdc0518c03b2cdf3253d4c52fd Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Tue, 17 Apr 2018 18:18:40 -0400 Subject: 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 --- apps/plugins/puzzles/src/unequal.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'apps/plugins/puzzles/src/unequal.c') diff --git a/apps/plugins/puzzles/src/unequal.c b/apps/plugins/puzzles/src/unequal.c index cb477c9..d8204a4 100644 --- a/apps/plugins/puzzles/src/unequal.c +++ b/apps/plugins/puzzles/src/unequal.c @@ -1280,6 +1280,21 @@ fail: return NULL; } +static char *game_request_keys(const game_params *params) +{ + int order = params->order; + char off = (order > 9) ? '0' : '1'; + char *keys = smalloc(order + 2); + int i; + for(i = 0; i < order; i++) { + if (i==10) off = 'a'-10; + keys[i] = i + off; + } + keys[order] = '\b'; + keys[order+1] = '\0'; + return keys; +} + static game_state *new_game(midend *me, const game_params *params, const char *desc) { @@ -2011,6 +2026,7 @@ const struct game thegame = { free_ui, encode_ui, decode_ui, + game_request_keys, game_changed_state, interpret_move, execute_move, -- cgit v1.1