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

Sharks - Jeannie #111

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

Sharks - Jeannie #111

wants to merge 10 commits into from

Conversation

jeanniezheng
Copy link

No description provided.

Copy link

@spitsfire spitsfire left a comment

Choose a reason for hiding this comment

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

well done, Jeannie! I added a few comments about syntax and a suggestion to help with efficiency. Other than that, it looks good!

} else {
playerHand.push(randomCharacter);
LETTER_POOL[randomCharacter] -= 1;
alphabet.replace(randomCharacter, '');

Choose a reason for hiding this comment

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

love this idea! One thing I would suggest is turning alphabet into an array instead of a string. That way when we change the index position's value to an empty string, we aren't creating a whole new copy of the data structure the way replace is doing.

Each time we call replace it has to make a new copy of the string.

};


export const usesAvailableLetters = (input, lettersInHand) => {

Choose a reason for hiding this comment

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

👍 very interesting approach!

Comment on lines +117 to +119
} if (word.length >= 7) {
score += 8;
}

Choose a reason for hiding this comment

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

I think standard practice is to have the if statement start on its own line. I only ever see a conditional on the same line as a closing curly brace is with else

Suggested change
} if (word.length >= 7) {
score += 8;
}
}
if (word.length >= 7) {
score += 8;
}

@@ -1,15 +1,157 @@

const score_chart = {

Choose a reason for hiding this comment

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

oop careful! use camel case in JavaScript:

Suggested change
const score_chart = {
const scoreChart = {

Comment on lines +126 to +128
let score_list = [];
let max_score = 0;
let winning_word = "";

Choose a reason for hiding this comment

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

Suggested change
let score_list = [];
let max_score = 0;
let winning_word = "";
let scoreList = [];
let maxScore = 0;
let winningWord = "";

if (item["score"] === max_score && item["word"].length === 10) {
winner = item;
return winner;
} else if (item["score"] === max_score && item["word"].length < winning_word.length) {

Choose a reason for hiding this comment

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

Suggested change
} else if (item["score"] === max_score && item["word"].length < winning_word.length) {
}
else if (item["score"] === max_score && item["word"].length < winning_word.length) {

};


export const highestScoreFrom = (words) => {

Choose a reason for hiding this comment

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

👍

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