Skip to content

Commit

Permalink
Merge pull request #3 from skedwards88/update-word-logic
Browse files Browse the repository at this point in the history
update word logic
  • Loading branch information
skedwards88 authored May 26, 2024
2 parents f15c50c + e057a7e commit a27afc1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
26 changes: 19 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 5 additions & 3 deletions src/logic/gameInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/logic/gameReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a27afc1

Please sign in to comment.