Skip to content

Commit

Permalink
constrain min pieces when generating a random puzzle after displaying…
Browse files Browse the repository at this point in the history
… a custom puzzle
  • Loading branch information
skedwards88 committed Aug 24, 2024
1 parent a4b6d98 commit a1264f4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/logic/gameInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a1264f4

Please sign in to comment.