shithub: puzzles

Download patch

ref: 49dbf1f60dc5c6bcb6b3ffadf89e7e0c14106638
parent: 387d323dd8d579db2c90b499b3b19f746cbdbce5
author: Ben Hutchings <ben@decadent.org.uk>
date: Fri Aug 10 03:00:06 EDT 2018

Pearl: Require width or height to be at least 6 for Tricky

Josh Triplett reported:
> If I ask pearl to generate a 5x5 tricky puzzle, it runs forever.

I find that 5x6 or 6x5 works, so set the minimum accordingly.

References: https://bugs.debian.org/667963

--- a/pearl.c
+++ b/pearl.c
@@ -274,6 +274,8 @@
     if (params->h < 5) return "Height must be at least five";
     if (params->difficulty < 0 || params->difficulty >= DIFFCOUNT)
         return "Unknown difficulty level";
+    if (params->difficulty >= DIFF_TRICKY && params->w + params->h < 11)
+	return "Width or height must be at least six for Tricky";
 
     return NULL;
 }