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

Amethyst- Stacy #75

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

Amethyst- Stacy #75

wants to merge 6 commits into from

Conversation

stacyyyd
Copy link

@stacyyyd stacyyyd commented Jun 7, 2023

No description provided.

@@ -1,15 +1,94 @@
export const drawLetters = () => {
// Implement this method for wave 1
var letters = {

Choose a reason for hiding this comment

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

I'm sure you know this now but we want to avoid using var, I think here we could use const instead.

Comment on lines +25 to +31
const weighted = (dict, randomPiece) => {
for (let [key, value] of Object.entries(dict)){
randomPiece -= value;
if (randomPiece <= 0){
return key;
}
}

Choose a reason for hiding this comment

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

Love this function! For readability we want to make sure we are placing our function definitions above the calls.

};

export const usesAvailableLetters = (input, lettersInHand) => {
// Implement this method for wave 2
let newLetterBank = [];

Choose a reason for hiding this comment

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

We could make a new letter bank with the Javascript spread syntax like so newLetterBank = [...lettersInHand]

sum += values[letter.toUpperCase()];
}
}
return sum;

Choose a reason for hiding this comment

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

⭐️

Comment on lines +74 to +76
let maxVal = 0;
let tempScore = 0;
let maxWord = "";

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?

maxVal = tempScore;
maxWord = word;
}
else if(maxVal == tempScore){

Choose a reason for hiding this comment

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

Love the if statements in this function, they are very concise!

}
}
};
return {"word": maxWord, "score": maxVal};

Choose a reason for hiding this comment

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

Nice job, Stacy! 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