diff --git a/package-lock.json b/package-lock.json index ad37461..0ee709e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.25", "dependencies": { "@skedwards88/word_lists": "latest", - "@skedwards88/word_logic": "^2.0.7", + "@skedwards88/word_logic": "^4.0.1", "react": "^18.2.0", "react-dom": "^18.2.0", "seedrandom": "3.0.5" @@ -2229,10 +2229,11 @@ "integrity": "sha512-GAozgHLq3FfZkqiG3cs4p96tFPlsQjcEtDlAI09MFB3Q80LwV0Puq5TcmNf18AxgKtsg4ml3mtmGLBWQ5EHO4g==" }, "node_modules/@skedwards88/word_logic": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@skedwards88/word_logic/-/word_logic-2.0.7.tgz", - "integrity": "sha512-MYF9ohnl1IH2JCJZaNpz+A/Cdk1NGg2i849Ea9EDEArJAUoTFWGtq6tDlRWjQJ3wN/IQnWOOrw6NP5M7Gfy1Mw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@skedwards88/word_logic/-/word_logic-4.0.1.tgz", + "integrity": "sha512-RSSUvtBFT+NbLbzt7SxD9QHLu0HONpXjRCzA6r3pFaTDuf6/D2+lRg1keni2X9ARVpS20oyVl8OYDPK0B/MTXg==", "dependencies": { + "lodash.clonedeep": "^4.5.0", "seedrandom": "^3.0.5" } }, @@ -6770,6 +6771,11 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==" + }, "node_modules/lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", @@ -12048,10 +12054,11 @@ "integrity": "sha512-GAozgHLq3FfZkqiG3cs4p96tFPlsQjcEtDlAI09MFB3Q80LwV0Puq5TcmNf18AxgKtsg4ml3mtmGLBWQ5EHO4g==" }, "@skedwards88/word_logic": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@skedwards88/word_logic/-/word_logic-2.0.7.tgz", - "integrity": "sha512-MYF9ohnl1IH2JCJZaNpz+A/Cdk1NGg2i849Ea9EDEArJAUoTFWGtq6tDlRWjQJ3wN/IQnWOOrw6NP5M7Gfy1Mw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@skedwards88/word_logic/-/word_logic-4.0.1.tgz", + "integrity": "sha512-RSSUvtBFT+NbLbzt7SxD9QHLu0HONpXjRCzA6r3pFaTDuf6/D2+lRg1keni2X9ARVpS20oyVl8OYDPK0B/MTXg==", "requires": { + "lodash.clonedeep": "^4.5.0", "seedrandom": "^3.0.5" } }, @@ -15478,6 +15485,11 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==" + }, "lodash.debounce": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", diff --git a/package.json b/package.json index 274f94b..e21b78e 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "homepage": "https://github.com/skedwards88/gribbles#readme", "dependencies": { "@skedwards88/word_lists": "latest", - "@skedwards88/word_logic": "^2.0.7", + "@skedwards88/word_logic": "^4.0.1", "react": "^18.2.0", "react-dom": "^18.2.0", "seedrandom": "3.0.5" diff --git a/src/logic/gameInit.js b/src/logic/gameInit.js index 778a01b..9020dd1 100644 --- a/src/logic/gameInit.js +++ b/src/logic/gameInit.js @@ -27,9 +27,11 @@ function getPlayableLetters({gridSize, minWordLength, easyMode, seed}) { while (!foundPlayableLetters) { letters = getLetters(gridSize, pseudoRandomGenerator); allWords = findAllWords({ - grid: letters, - minWordLength: minWordLength, - easyMode: easyMode, + letters, + numColumns: Math.sqrt(letters.length), + numRows: Math.sqrt(letters.length), + minWordLength, + easyMode, trie, }); if (allWords.length > minWords) { diff --git a/src/logic/gameReducer.js b/src/logic/gameReducer.js index c4e4d9c..443c93c 100644 --- a/src/logic/gameReducer.js +++ b/src/logic/gameReducer.js @@ -30,7 +30,8 @@ export function gameReducer(currentGameState, payload) { currentGameState.playedIndexes.length - 1 ], indexB: payload.letterIndex, - gridSize: Math.sqrt(currentGameState.letters.length), + numColumns: Math.sqrt(currentGameState.letters.length), + numRows: Math.sqrt(currentGameState.letters.length), }); if (!isNeighboring) { return currentGameState;