Skip to content
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

SL - Presley #132

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

SL - Presley #132

wants to merge 2 commits into from

Conversation

ptieman
Copy link

@ptieman ptieman commented Dec 18, 2022

Struggled a bit with wave 4 - not really sure if the direction I was going made sense. Thanks for all your patience as I catch up, it's much appreciated <3 :)

Copy link

@yangashley yangashley left a comment

Choose a reason for hiding this comment

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

Nice job! Let me know if you have any questions about the comments.

I think I found part of the bug in the method that handles ties that's leading to some tests failing and left a comment to call your attention to it

// Implement this method for wave 1
const handOfLetters = [];

const lettersPool = {

Choose a reason for hiding this comment

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

Since this is hardcoded value that shouldn't change (which it can't because you use const), you can rename this variable to LETTERS_POOL

Comment on lines +35 to +36
const pool = [];
for (const [letter, quantity] of Object.entries(lettersPool)) {

Choose a reason for hiding this comment

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

Nice job using const for these variables here

pool.splice(getTheNum, 1);
};

return handOfLetters
};

Choose a reason for hiding this comment

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

The helper functions createPool and getNum should be created outside of the function drawLetters, but since they'd all be in the adagrams.js file, your drawLetters function will still be able to access them.

If you want to read more about benefits/disadvantages to nested functions, here's a resource: https://evgenii.info/nested-functions/

export const usesAvailableLetters = (input, lettersInHand) => {
// Implement this method for wave 2
const lettersInHandCopy = [...lettersInHand];
const turnUpperCase = input.toUpperCase();

Choose a reason for hiding this comment

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

Usually we use verbs for variables that refer to a function that does something. You could rename this to upperCaseWord. If you had a custom method that had logic to make a word uppercase different from the built in one you used then turnUpperCase would be great for that.

// This wave is still failing one test and I'm stuck on how to get it
// to return 0

const letterScores = {

Choose a reason for hiding this comment

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

Could also rename this with caps and underscore to indicate it's a hardcoded value that shouldn't be changed, like LETTER_SCORES

Comment on lines +82 to +83
// This wave is still failing one test and I'm stuck on how to get it
// to return 0

Choose a reason for hiding this comment

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

I ran the tests for scoreWord and they passed on my end. Your logic looks fine. I do see the tests for tied scores failing.

Comment on lines +115 to +117
if(word === '') {
return totalScore;
}

Choose a reason for hiding this comment

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

You can get rid of this here because if word is an empty string then no iterating will happen on line 118-120, and then your method returns totalScore which is still 0 (unchanged since none of the logic ran)

}
}

if (maxWords.length === 1) {

Choose a reason for hiding this comment

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

I think the issue with the logic for handling ties is here. When I ran the tests, I saw there were times when maxWords.length != 1 (instead it had 2 words in it)

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