-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amethyst Megan G. #146
base: main
Are you sure you want to change the base?
Amethyst Megan G. #146
Conversation
…s than the total amount of that letter
… quanity of letters in hand
const lettersDrawnForHand = []; | ||
|
||
while (lettersDrawnForHand.length < 10) { | ||
let randomLetter = generateRandomLetter(); |
There was a problem hiding this comment.
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.
export const usesAvailableLetters = (input, lettersInHand) => { | ||
// Implement this method for wave 2 | ||
const letterHandCopy = JSON.parse(JSON.stringify(lettersInHand)); |
There was a problem hiding this comment.
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]
.
score += 8; | ||
} | ||
|
||
return score; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⭐️
let highestScore = 0; | ||
let highestScoringWord = ''; |
There was a problem hiding this comment.
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?
highestScoringWord = word; | ||
} | ||
else if (score === highestScore) { | ||
if(highestScoringWord.length != 10 && (word.length === 10 || word.length < highestScoringWord.length)) { |
There was a problem hiding this comment.
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!
return { | ||
'score': highestScore, | ||
'word': highestScoringWord | ||
} |
There was a problem hiding this comment.
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!
No description provided.