Skip to content

Amethyst Megan G.#146

Open
scrambledmegs wants to merge 11 commits intoAda-C18:mainfrom
scrambledmegs:main
Open

Amethyst Megan G.#146
scrambledmegs wants to merge 11 commits intoAda-C18:mainfrom
scrambledmegs:main

Conversation

@scrambledmegs
Copy link
Copy Markdown

No description provided.

Comment thread src/adagrams.js
const lettersDrawnForHand = [];

while (lettersDrawnForHand.length < 10) {
let randomLetter = generateRandomLetter();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, when you defined generateRandomLetter, you make a call of createLetteList in it to create your list of letters from your LETTER_POOL. With this being said, every iteration of your while loop will make a new list of letters even though we don't really need a new list (it will look the same every time). I would suggest pulling it out of this function and calling createLetterList somewhere above the while loop in this function.

Comment thread src/adagrams.js
// handles the correct quantity of letters in hand
export const usesAvailableLetters = (input, lettersInHand) => {
// Implement this method for wave 2
const letterHandCopy = JSON.parse(JSON.stringify(lettersInHand));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are most likely aware of this now, but just in case you can make a copy array with the spread syntax like so [...lettersInHand].

Comment thread src/adagrams.js
score += 8;
}

return score;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⭐️

Comment thread src/adagrams.js
Comment on lines +133 to +134
let highestScore = 0;
let highestScoringWord = '';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we know we want to return these variables in object form, could just initialize said object here?

Comment thread src/adagrams.js
highestScoringWord = word;
}
else if (score === highestScore) {
if(highestScoringWord.length != 10 && (word.length === 10 || word.length < highestScoringWord.length)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the compound if statement very easy to follow!

Comment thread src/adagrams.js
return {
'score': highestScore,
'word': highestScoringWord
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job, Megs! As you probably noticed, I didn't give too much feedback due to the scope of the project (Translating your python code to Javascript code). I tried to just point out any glaring issues, if any. With that being said, if you want to discuss anything in greater detail, feel free to reach out to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants