From 69e63a810e0bd6f85a46d8490c6e366237e061ef Mon Sep 17 00:00:00 2001 From: Chris Boyle Date: Tue, 20 Dec 2016 09:13:20 +0000 Subject: [PATCH] magnets: Area constraints; fix message. (The restriction on 2x2 puzzles is because the board layer-out doesn't use neutral pieces on such small boards, and the only soluble 2x2 boards have neutral pieces. I haven't investigated the Tricky size limit, but it seems entirely reasonable that all the smaller boards are too easy. --bjh21) (cherry picked from Android port, commit 133794977a13767e0c1596be6a5b26f2cf2d1fd1) --- magnets.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/magnets.c b/magnets.c index 580f2a2..6a3ac52 100644 --- a/magnets.c +++ b/magnets.c @@ -230,8 +230,15 @@ static game_params *custom_params(const config_item *cfg) static const char *validate_params(const game_params *params, bool full) { - if (params->w < 2) return "Width must be at least one"; - if (params->h < 2) return "Height must be at least one"; + if (params->w < 2) return "Width must be at least two"; + if (params->h < 2) return "Height must be at least two"; + if (params->diff >= DIFF_TRICKY) { + if (params->w < 5 && params->h < 5) + return "Either width or height must be at least five for Tricky"; + } else { + if (params->w < 3 && params->h < 3) + return "Either width or height must be at least three"; + } if (params->diff < 0 || params->diff >= DIFFCOUNT) return "Unknown difficulty level";