From a1264f403d81eb7ca562005e91923e00d0e1749d Mon Sep 17 00:00:00 2001 From: skedwards88 Date: Sat, 24 Aug 2024 09:38:06 -0700 Subject: [PATCH] constrain min pieces when generating a random puzzle after displaying a custom puzzle --- src/logic/gameInit.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/logic/gameInit.js b/src/logic/gameInit.js index 02092bf..a3d0531 100644 --- a/src/logic/gameInit.js +++ b/src/logic/gameInit.js @@ -71,7 +71,9 @@ export function gameInit({ let maxShiftRight; let maxShiftUp; let maxShiftDown; - let minLetters = isDaily ? getNumLettersForDay() : numLetters || 30; + let minLetters = isDaily + ? getNumLettersForDay() + : Math.min(Math.max(numLetters, 20), 60) || 30; // Custom puzzles can exceed the min/max letters used for a randomly generated game. Constrain min letters in this cases so that future randomly generated games don't use these extreme values. let gridSize = getGridSizeForLetters(minLetters); // If custom, attempt to generate the custom puzzle represented by the seed.